From ccb4a7dd5eaffe8f3d9e6eb66facb07f10dd2f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Wed, 2 Dec 2015 20:41:59 +0100 Subject: [PATCH] Trash some not needed patches --- patch/devices/sun4i-a10.h | 62 - patch/devices/sun6i-a31s-bananapi-m2.dts | 244 -- patch/devices/sun7i-a20-bananapi-m1-plus.dts | 294 -- patch/devices/sun7i-a20-bananapi-r1.dts | 229 -- patch/devices/sun7i-a20-lamobo-r1.dts | 238 -- patch/devices/sun7i-a20-orangepi-mini.dts | 244 -- patch/devices/sun7i-a20-orangepi.dts | 225 -- patch/devices/sun7i-a20-pcduino3-nano.dts | 191 - ...-Add-Security-System-to-A10s-SoC-DTS.patch | 38 - patch/kernel/0001-I2S-module-rework.patch | 1143 ------ ...t-Add-Security-System-to-A31-SoC-DTS.patch | 53 - ...t-Add-Security-System-to-A10-SoC-DTS.patch | 38 - ...t-Add-Security-System-to-A20-SoC-DTS.patch | 38 - ...-DT-bindings-documentation-for-SUN4I.patch | 43 - ...nner-Security-System-crypto-accelera.patch | 1717 -------- ...myself-as-maintainer-of-Allwinner-Se.patch | 31 - ...-ss-support-the-Security-System-PRNG.patch | 183 - patch/kernel/0009-a31_breaks.patch | 21 - patch/kernel/allwinner-audio-4.x.patch | 1929 --------- patch/kernel/aufs3-base.patch | 70 - patch/kernel/aufs3-kbuild.patch | 38 - patch/kernel/aufs3-mmap.patch | 349 -- patch/kernel/aufs3-standalone.patch | 257 -- patch/kernel/h3-7498741.patch | 119 - patch/kernel/h3-7498751.patch | 232 -- patch/kernel/h3-7498761.patch | 110 - patch/kernel/h3-7498771.patch | 130 - patch/kernel/h3-7498831.patch | 592 --- patch/kernel/h3-7498891.patch | 517 --- patch/kernel/neo-patch-3.14.35-36 | 3448 ----------------- patch/kernel/neo-patch-3.14.36-37 | 2861 -------------- patch/kernel/neo-patch-3.14.37-38 | 1016 ----- patch/kernel/neo-patch-3.14.38-39 | 1101 ------ patch/kernel/old-h3-7458441.patch | 226 -- patch/kernel/old-h3-7458451.patch | 119 - patch/kernel/old-h3-7458631.patch | 55 - patch/kernel/old-h3-7458651.patch | 534 --- patch/kernel/old-h3-7458661.patch | 127 - patch/kernel/old-h3-7458701.patch | 593 --- patch/kernel/packaging-next.patch.old | 133 - patch/kernel/spi-sun7i.patch | 2262 ----------- patch/u-boot/bananapi_enable_usb_otg.patch | 11 - patch/u-boot/second_sd_card_cubieboard2.patch | 10 - patch/u-boot/udoo-uboot-fatboot.patch | 50 - patch/u-boot/udoo.h | 238 -- patch/u-boot/udoo_neo.h | 393 -- 46 files changed, 22552 deletions(-) delete mode 100644 patch/devices/sun4i-a10.h delete mode 100644 patch/devices/sun6i-a31s-bananapi-m2.dts delete mode 100644 patch/devices/sun7i-a20-bananapi-m1-plus.dts delete mode 100644 patch/devices/sun7i-a20-bananapi-r1.dts delete mode 100644 patch/devices/sun7i-a20-lamobo-r1.dts delete mode 100644 patch/devices/sun7i-a20-orangepi-mini.dts delete mode 100644 patch/devices/sun7i-a20-orangepi.dts delete mode 100644 patch/devices/sun7i-a20-pcduino3-nano.dts delete mode 100644 patch/kernel/0001-ARM-sun5i-dt-Add-Security-System-to-A10s-SoC-DTS.patch delete mode 100644 patch/kernel/0001-I2S-module-rework.patch delete mode 100644 patch/kernel/0002-ARM-sun6i-dt-Add-Security-System-to-A31-SoC-DTS.patch delete mode 100644 patch/kernel/0003-ARM-sun4i-dt-Add-Security-System-to-A10-SoC-DTS.patch delete mode 100644 patch/kernel/0004-ARM-sun7i-dt-Add-Security-System-to-A20-SoC-DTS.patch delete mode 100644 patch/kernel/0005-ARM-sun4i-dt-Add-DT-bindings-documentation-for-SUN4I.patch delete mode 100644 patch/kernel/0006-crypto-Add-Allwinner-Security-System-crypto-accelera.patch delete mode 100644 patch/kernel/0007-MAINTAINERS-Add-myself-as-maintainer-of-Allwinner-Se.patch delete mode 100644 patch/kernel/0008-crypto-sun4i-ss-support-the-Security-System-PRNG.patch delete mode 100644 patch/kernel/0009-a31_breaks.patch delete mode 100644 patch/kernel/allwinner-audio-4.x.patch delete mode 100644 patch/kernel/aufs3-base.patch delete mode 100644 patch/kernel/aufs3-kbuild.patch delete mode 100644 patch/kernel/aufs3-mmap.patch delete mode 100644 patch/kernel/aufs3-standalone.patch delete mode 100644 patch/kernel/h3-7498741.patch delete mode 100644 patch/kernel/h3-7498751.patch delete mode 100644 patch/kernel/h3-7498761.patch delete mode 100644 patch/kernel/h3-7498771.patch delete mode 100644 patch/kernel/h3-7498831.patch delete mode 100644 patch/kernel/h3-7498891.patch delete mode 100644 patch/kernel/neo-patch-3.14.35-36 delete mode 100644 patch/kernel/neo-patch-3.14.36-37 delete mode 100644 patch/kernel/neo-patch-3.14.37-38 delete mode 100644 patch/kernel/neo-patch-3.14.38-39 delete mode 100644 patch/kernel/old-h3-7458441.patch delete mode 100644 patch/kernel/old-h3-7458451.patch delete mode 100644 patch/kernel/old-h3-7458631.patch delete mode 100644 patch/kernel/old-h3-7458651.patch delete mode 100644 patch/kernel/old-h3-7458661.patch delete mode 100644 patch/kernel/old-h3-7458701.patch delete mode 100644 patch/kernel/packaging-next.patch.old delete mode 100644 patch/kernel/spi-sun7i.patch delete mode 100644 patch/u-boot/bananapi_enable_usb_otg.patch delete mode 100644 patch/u-boot/second_sd_card_cubieboard2.patch delete mode 100644 patch/u-boot/udoo-uboot-fatboot.patch delete mode 100644 patch/u-boot/udoo.h delete mode 100644 patch/u-boot/udoo_neo.h diff --git a/patch/devices/sun4i-a10.h b/patch/devices/sun4i-a10.h deleted file mode 100644 index f7553c143..000000000 --- a/patch/devices/sun4i-a10.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2014 Maxime Ripard - * - * Maxime Ripard - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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 file; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __DT_BINDINGS_PINCTRL_SUN4I_A10_H_ -#define __DT_BINDINGS_PINCTRL_SUN4I_A10_H_ - -#define SUN4I_PINCTRL_10_MA 0 -#define SUN4I_PINCTRL_20_MA 1 -#define SUN4I_PINCTRL_30_MA 2 -#define SUN4I_PINCTRL_40_MA 3 - -#define SUN4I_PINCTRL_NO_PULL 0 -#define SUN4I_PINCTRL_PULL_UP 1 -#define SUN4I_PINCTRL_PULL_DOWN 2 - -#endif /* __DT_BINDINGS_PINCTRL_SUN4I_A10_H_ */ diff --git a/patch/devices/sun6i-a31s-bananapi-m2.dts b/patch/devices/sun6i-a31s-bananapi-m2.dts deleted file mode 100644 index 6bbed73e5..000000000 --- a/patch/devices/sun6i-a31s-bananapi-m2.dts +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2015 Hans de Goede - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun6i-a31.dtsi" -#include "sunxi-common-regulators.dtsi" - -#include -#include - -/ { - model = "Banana Pi BPI-M2"; - compatible = "sinovoip,bpi-m2", "allwinner,sun6i-a31"; - - aliases { - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_bananapi>; - green { - label = "bananapi:green:usr"; - gpios = <&pio 6 10 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; - }; - blue { - label = "bananapi:blue:usr"; - gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "mmc0"; - }; - red { - label = "bananapi:red:usr"; - gpios = <&pio 6 5 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "default-on"; - }; - }; - - g40_leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&g40_pins_bananapi>; - pm2 { - label = "bananapi:pm2:usr"; - gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; - }; - }; - - reg_vmmc2: vmmc2 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&vmmc2_pin_bananapi>; - regulator-name = "vmmc2"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - regulator-boot-on; - enable-active-high; - gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ -// gpio = <&r_pio 1 0 GPIO_ACTIVE_HIGH>; /* PM0 */ - }; -}; - -&ohci0 { - status = "okay"; -}; - -&ehci0 { - status = "okay"; -}; - -&gmac { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - snps,reset-gpio = <&pio 0 21 GPIO_ACTIVE_HIGH>; - snps,reset-active-low; - snps,reset-delays-us = <0 10000 30000>; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; -}; - -&i2c0 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - /* pull-ups and devices require AXP221 DLDO3 */ - status = "failed"; -}; - -&i2c1 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c1_pins_a>; - status = "okay"; -}; - -&i2c2 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c2_pins_a>; - status = "okay"; -}; - -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>; - vmmc-supply = <®_vcc3v0>; - bus-width = <4>; - cd-gpios = <&pio 0 4 GPIO_ACTIVE_HIGH>; /* PA4 */ - cd-inverted; - status = "okay"; -}; - -&mmc2 { - #address-cells = <1>; - #size-cells = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&mmc2_pins_a>; - vmmc-supply = <®_vmmc2>; - bus-width = <4>; - non-removable; - enable-sdio-wakeup; - status = "okay"; - -/* - brcmf: bcrmf@1 { - reg = <1>; - compatible = "brcm,bcm4329-fmac"; - interrupt-parent = <&pio>; - interrupts = <5 0>; - interrupt-names = "host-wake"; - status = "okay"; - }; -*/ -}; - -&mmc0_pins_a { - /* external pull-ups missing for some pins */ - allwinner,pull = ; -}; - -&mmc2_pins_a { - /* external pull-ups missing for some pins */ - allwinner,pull = ; -}; - -&pio { - led_pins_bananapi: led_pins@0 { - allwinner,pins = "PG10", "PG5", "PG11"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - mmc0_cd_pin_bananapi: mmc0_cd_pin@0 { - allwinner,pins = "PA4"; - allwinner,function = "gpio_in"; - allwinner,drive = ; - allwinner,pull = ; - }; - - mmc2_pins_a: mmc2@0 { - allwinner,pins = "PC6","PC7","PC8","PC9","PC10","PC11"; - allwinner,function = "mmc2"; - allwinner,drive = ; - allwinner,pull = ; - }; - - -}; - -&r_pio { - g40_pins_bananapi: g40_pins@0 { - allwinner,pins = "PM2"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - vmmc2_pin_bananapi: vmmc2_pin@0 { - allwinner,pins = "PL8"; -// allwinner,pins = "PM0"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; -}; - -&usbphy { - status = "okay"; -}; diff --git a/patch/devices/sun7i-a20-bananapi-m1-plus.dts b/patch/devices/sun7i-a20-bananapi-m1-plus.dts deleted file mode 100644 index e62e4afa5..000000000 --- a/patch/devices/sun7i-a20-bananapi-m1-plus.dts +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright 2015 Hans de Goede - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun7i-a20.dtsi" -#include "sunxi-common-regulators.dtsi" -#include -#include - -/ { - model = "Banana Pi BPI-M1-Plus"; - compatible = "sinovoip,bpi-m1-plus", "allwinner,sun7i-a20"; - - aliases { - serial0 = &uart0; - serial1 = &uart2; - serial2 = &uart3; - serial3 = &uart7; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_bananapi>; - - red { - label = "bananapi:red:usr"; - gpios = <&pio 7 25 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "default-on"; - }; - - green { - label = "bananapi:green:usr"; - gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; - - }; - }; - - reg_gmac_3v3: gmac-3v3 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&gmac_power_pin_bananapi>; - regulator-name = "gmac-3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - startup-delay-us = <100000>; - enable-active-high; - gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; - }; - - reg_vmmc3: vmmc3 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&vmmc3_pin_bananapi>; - regulator-name = "vmmc3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - regulator-boot-on; - enable-active-high; - gpio = <&pio 7 22 GPIO_ACTIVE_HIGH>; - }; -}; - -&ahci { - status = "okay"; -}; - -&ehci0 { - status = "okay"; -}; - -&ehci1 { - status = "okay"; -}; - -&ohci0 { - status = "okay"; -}; - -&ohci1 { - status = "okay"; -}; - -&gmac { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; -}; - -&i2c0 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - status = "okay"; - - axp209: pmic@34 { - compatible = "x-powers,axp209"; - reg = <0x34>; - interrupt-parent = <&nmi_intc>; - interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - - interrupt-controller; - #interrupt-cells = <1>; - }; -}; - -&i2c2 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c2_pins_a>; - status = "okay"; -}; - -&ir0 { - pinctrl-names = "default"; - pinctrl-0 = <&ir0_rx_pins_a>; - status = "okay"; -}; - -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ - cd-inverted; - status = "okay"; -}; - -&mmc3 { - #address-cells = <1>; - #size-cells = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&mmc3_pins_a>; - vmmc-supply = <®_vmmc3>; - bus-width = <4>; - non-removable; - enable-sdio-wakeup; - status = "okay"; - -/* - brcmf: bcrmf@1 { - reg = <1>; - compatible = "brcm,bcm4329-fmac"; - interrupt-parent = <&pio>; - interrupts = <15 8>; - interrupt-names = "host-wake"; - }; -*/ -}; - -&pio { - gmac_power_pin_bananapi: gmac_power_pin@0 { - allwinner,pins = "PH23"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - led_pins_bananapi: led_pins@0 { - allwinner,pins = "PH24", "PG2"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - mmc0_cd_pin_bananapi: mmc0_cd_pin@0 { - allwinner,pins = "PH10"; - allwinner,function = "gpio_in"; - allwinner,drive = ; - allwinner,pull = ; - }; - - usb1_vbus_pin_bananapi: usb1_vbus_pin@0 { - allwinner,pins = "PH0"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - usb2_vbus_pin_bananapi: usb2_vbus_pin@0 { - allwinner,pins = "PH1"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - vmmc3_pin_bananapi: vmmc3_pin@0 { - allwinner,pins = "PH22"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; -}; - -®_usb1_vbus { - pinctrl-0 = <&usb1_vbus_pin_bananapi>; - gpio = <&pio 7 0 GPIO_ACTIVE_HIGH>; /* PH0 */ - status = "okay"; -}; - -®_usb2_vbus { - pinctrl-0 = <&usb2_vbus_pin_bananapi>; - gpio = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ - status = "okay"; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins_a>, - <&spi0_cs0_pins_a>, - <&spi0_cs1_pins_a>; - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; -}; - -&uart2 { - pinctrl-names = "default"; - pinctrl-0 = <&uart2_pins_a>; - status = "okay"; -}; - -&uart3 { - pinctrl-names = "default"; - pinctrl-0 = <&uart3_pins_b>; - status = "okay"; -}; - -&uart7 { - pinctrl-names = "default"; - pinctrl-0 = <&uart7_pins_a>; - status = "okay"; -}; - -&usbphy { - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb2_vbus>; - status = "okay"; -}; diff --git a/patch/devices/sun7i-a20-bananapi-r1.dts b/patch/devices/sun7i-a20-bananapi-r1.dts deleted file mode 100644 index a287819c3..000000000 --- a/patch/devices/sun7i-a20-bananapi-r1.dts +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2015 Hans de Goede - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun7i-a20.dtsi" -#include "sunxi-common-regulators.dtsi" - -#include -#include -#include - -/ { - model = "Banana Pi BPI-R1"; - compatible = "sinovoip,bpi-r1", "allwinner,sun7i-a20"; - - aliases { - serial0 = &uart0; - serial1 = &uart2; - serial2 = &uart3; - serial3 = &uart7; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_bananapi>; - - green { - label = "bananapi:green:usr"; - gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; - }; - }; - - reg_gmac_3v3: gmac-3v3 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&gmac_power_pin_bananapi>; - regulator-name = "gmac-3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - startup-delay-us = <100000>; - enable-active-high; - gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; - }; -}; - -&ahci { - status = "okay"; -}; - -&ehci0 { - status = "okay"; -}; - -&ehci1 { - status = "okay"; -}; - -&ohci0 { - status = "okay"; -}; - -&ohci1 { - status = "okay"; -}; - -&gmac { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; -}; - -&i2c0 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - status = "okay"; - - axp209: pmic@34 { - compatible = "x-powers,axp209"; - reg = <0x34>; - interrupt-parent = <&nmi_intc>; - interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - - interrupt-controller; - #interrupt-cells = <1>; - }; -}; - -&i2c2 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c2_pins_a>; - status = "okay"; -}; - -&ir0 { - pinctrl-names = "default"; - pinctrl-0 = <&ir0_rx_pins_a>; - status = "okay"; -}; - -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ - cd-inverted; - status = "okay"; -}; - -&pio { - mmc0_cd_pin_bananapi: mmc0_cd_pin@0 { - allwinner,pins = "PH10"; - allwinner,function = "gpio_in"; - allwinner,drive = ; - allwinner,pull = ; - }; - - gmac_power_pin_bananapi: gmac_power_pin@0 { - allwinner,pins = "PH23"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - led_pins_bananapi: led_pins@0 { - allwinner,pins = "PH24"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; -}; - -®_usb1_vbus { - status = "okay"; -}; - -®_usb2_vbus { - status = "okay"; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins_a>, - <&spi0_cs0_pins_a>, - <&spi0_cs1_pins_a>; - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; -}; - -&uart2 { - pinctrl-names = "default"; - pinctrl-0 = <&uart2_pins_a>; - status = "okay"; -}; - -&uart3 { - pinctrl-names = "default"; - pinctrl-0 = <&uart3_pins_b>; - status = "okay"; -}; - -&uart7 { - pinctrl-names = "default"; - pinctrl-0 = <&uart7_pins_a>; - status = "okay"; -}; - -&usbphy { - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb2_vbus>; - status = "okay"; -}; diff --git a/patch/devices/sun7i-a20-lamobo-r1.dts b/patch/devices/sun7i-a20-lamobo-r1.dts deleted file mode 100644 index 69b11dc6f..000000000 --- a/patch/devices/sun7i-a20-lamobo-r1.dts +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2014 Hans de Goede - * - * Hans de Goede - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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 file; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun7i-a20.dtsi" -#include "sunxi-common-regulators.dtsi" - -#include -#include -#include - -/ { - model = "Lamobo R1"; - compatible = "lamobo,lamobo-r1", "allwinner,sun7i-a20"; - - aliases { - serial0 = &uart0; - serial1 = &uart3; - serial2 = &uart7; - }; - - soc@01c00000 { - spi0: spi@01c05000 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins_a>; - status = "okay"; - }; - - mmc0: mmc@01c0f000 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 10 0>; /* PH10 */ - cd-inverted; - status = "okay"; - }; - - usbphy: phy@01c13400 { - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb2_vbus>; - status = "okay"; - }; - - ehci0: usb@01c14000 { - status = "okay"; - }; - - ohci0: usb@01c14400 { - status = "okay"; - }; - - ahci: sata@01c18000 { - status = "okay"; - }; - - ehci1: usb@01c1c000 { - status = "okay"; - }; - - ohci1: usb@01c1c400 { - status = "okay"; - }; - - pinctrl@01c20800 { - mmc0_cd_pin_bananapi: mmc0_cd_pin@0 { - allwinner,pins = "PH10"; - allwinner,function = "gpio_in"; - allwinner,drive = <0>; - allwinner,pull = <1>; - }; - - gmac_power_pin_bananapi: gmac_power_pin@0 { - allwinner,pins = "PH23"; - allwinner,function = "gpio_out"; - allwinner,drive = <0>; - allwinner,pull = <0>; - }; - - led_pins_bananapi: led_pins@0 { - allwinner,pins = "PH24"; - allwinner,function = "gpio_out"; - allwinner,drive = <0>; - allwinner,pull = <0>; - }; - - ahci_pwr_pin_a: ahci_pwr_pin@0 { - allwinner,pins = "PB3"; - allwinner,function = "gpio_out"; - allwinner,drive = <0>; - allwinner,pull = <0>; - }; - - }; - - uart0: serial@01c28000 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; - }; - - uart3: serial@01c28c00 { - pinctrl-names = "default"; - pinctrl-0 = <&uart3_pins_b>; - status = "okay"; - }; - - uart7: serial@01c29c00 { - pinctrl-names = "default"; - pinctrl-0 = <&uart7_pins_a>; - status = "okay"; - }; - - i2c0: i2c@01c2ac00 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - status = "okay"; - - axp209: pmic@34 { - compatible = "x-powers,axp209"; - reg = <0x34>; - interrupt-parent = <&nmi_intc>; - interrupts = <0 8>; - - interrupt-controller; - #interrupt-cells = <1>; - }; - }; - - i2c2: i2c@01c2b400 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c2_pins_a>; - status = "okay"; - }; - - gmac: ethernet@01c50000 { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; - }; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_bananapi>; - - green { - label = "bananapi:green:usr"; - gpios = <&pio 7 24 0>; - }; - }; - - reg_usb1_vbus: usb1-vbus { - status = "okay"; - }; - - reg_usb2_vbus: usb2-vbus { - status = "okay"; - }; - - reg_gmac_3v3: gmac-3v3 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&gmac_power_pin_bananapi>; - regulator-name = "gmac-3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - startup-delay-us = <100000>; - enable-active-high; - gpio = <&pio 7 23 0>; - }; - - reg_ahci_5v: ahci-5v { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&ahci_pwr_pin_a>; - regulator-name = "ahci-5v"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - enable-active-high; - gpio = <&pio 1 3 0>; - status = "okay"; - }; -}; diff --git a/patch/devices/sun7i-a20-orangepi-mini.dts b/patch/devices/sun7i-a20-orangepi-mini.dts deleted file mode 100644 index ea07bc84f..000000000 --- a/patch/devices/sun7i-a20-orangepi-mini.dts +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2015 Hans de Goede - * - * Hans de Goede - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun7i-a20.dtsi" -#include "sunxi-common-regulators.dtsi" - -#include -#include -#include - -/ { - model = "Orange Pi Mini"; - compatible = "xunlong,orangepi-mini", "allwinner,sun7i-a20"; - - aliases { - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_orangepi>; - - green { - label = "orangepi:green:usr"; - gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>; /* PH24 */ - }; - - blue { - label = "orangepi:blue:usr"; - gpios = <&pio 7 25 GPIO_ACTIVE_HIGH>; /* PH25 */ - }; - }; - - reg_gmac_3v3: gmac-3v3 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&gmac_power_pin_orangepi>; - regulator-name = "gmac-3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - startup-delay-us = <100000>; - enable-active-high; - gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */ - }; -}; - -&ahci { - status = "okay"; -}; - -&ehci0 { - status = "okay"; -}; - -&ehci1 { - status = "okay"; -}; - -&gmac { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; -}; - -&i2c0 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - status = "okay"; - - axp209: pmic@34 { - reg = <0x34>; - interrupt-parent = <&nmi_intc>; - interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - }; -}; - -#include "axp209.dtsi" - -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_orangepi>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ - cd-inverted; - status = "okay"; -}; - -&mmc3 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc3_pins_a>, <&mmc3_cd_pin_orangepi>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ - cd-inverted; - status = "okay"; -}; - -&pio { - mmc0_cd_pin_orangepi: mmc0_cd_pin@0 { - allwinner,pins = "PH10"; - allwinner,function = "gpio_in"; - allwinner,drive = ; - allwinner,pull = ; - }; - - mmc3_cd_pin_orangepi: mmc3_cd_pin@0 { - allwinner,pins = "PH11"; - allwinner,function = "gpio_in"; - allwinner,drive = ; - allwinner,pull = ; - }; - - usb2_vbus_pin_bananapro: usb2_vbus_pin@0 { - allwinner,pins = "PH22"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - gmac_power_pin_orangepi: gmac_power_pin@0 { - allwinner,pins = "PH23"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - led_pins_orangepi: led_pins@0 { - allwinner,pins = "PH24", "PH25"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - usb1_vbus_pin_bananapro: usb1_vbus_pin@0 { - allwinner,pins = "PH26"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; -}; - -®_dcdc2 { - regulator-always-on; - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1500000>; - regulator-name = "vdd-cpu"; -}; - -®_dcdc3 { - regulator-always-on; - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1400000>; - regulator-name = "vdd-int-pll"; -}; - -®_ldo1 { - regulator-name = "vdd-rtc"; -}; - -®_ldo2 { - regulator-always-on; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - regulator-name = "avcc"; -}; - -®_usb1_vbus { - pinctrl-0 = <&usb1_vbus_pin_bananapro>; - gpio = <&pio 7 26 GPIO_ACTIVE_HIGH>; /* PH26 */ - status = "okay"; -}; - -®_usb2_vbus { - pinctrl-0 = <&usb2_vbus_pin_bananapro>; - gpio = <&pio 7 22 GPIO_ACTIVE_HIGH>; /* PH22 */ - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; -}; - -&usbphy { - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb2_vbus>; - status = "okay"; -}; diff --git a/patch/devices/sun7i-a20-orangepi.dts b/patch/devices/sun7i-a20-orangepi.dts deleted file mode 100644 index c40568a25..000000000 --- a/patch/devices/sun7i-a20-orangepi.dts +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 2014 Hans de Goede - * - * Hans de Goede - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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 file; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun7i-a20.dtsi" -#include "sunxi-common-regulators.dtsi" - -#include -#include -#include - -/ { - model = "Orange PI"; - compatible = "lemaker,bananapi", "allwinner,sun7i-a20"; - - aliases { - serial0 = &uart0; - serial1 = &uart3; - serial2 = &uart7; - }; - - soc@01c00000 { - spi0: spi@01c05000 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins_a>; - status = "okay"; - }; - - mmc0: mmc@01c0f000 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 10 0>; /* PH10 */ - cd-inverted; - status = "okay"; - }; - - usbphy: phy@01c13400 { - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb2_vbus>; - status = "okay"; - }; - - ehci0: usb@01c14000 { - status = "okay"; - }; - - ohci0: usb@01c14400 { - status = "okay"; - }; - - ahci: sata@01c18000 { - status = "okay"; - }; - - ehci1: usb@01c1c000 { - status = "okay"; - }; - - ohci1: usb@01c1c400 { - status = "okay"; - }; - - pinctrl@01c20800 { - mmc0_cd_pin_bananapi: mmc0_cd_pin@0 { - allwinner,pins = "PH10"; - allwinner,function = "gpio_in"; - allwinner,drive = <0>; - allwinner,pull = <1>; - }; - - gmac_power_pin_bananapi: gmac_power_pin@0 { - allwinner,pins = "PH23"; - allwinner,function = "gpio_out"; - allwinner,drive = <0>; - allwinner,pull = <0>; - }; - - led_pins_bananapi: led_pins@0 { - allwinner,pins = "PH24"; - allwinner,function = "gpio_out"; - allwinner,drive = <0>; - allwinner,pull = <0>; - }; - - }; - - ir0: ir@01c21800 { - pinctrl-names = "default"; - pinctrl-0 = <&ir0_pins_a>; - status = "okay"; - }; - - uart0: serial@01c28000 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; - }; - - uart3: serial@01c28c00 { - pinctrl-names = "default"; - pinctrl-0 = <&uart3_pins_b>; - status = "okay"; - }; - - uart7: serial@01c29c00 { - pinctrl-names = "default"; - pinctrl-0 = <&uart7_pins_a>; - status = "okay"; - }; - - i2c0: i2c@01c2ac00 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - status = "okay"; - - axp209: pmic@34 { - compatible = "x-powers,axp209"; - reg = <0x34>; - interrupt-parent = <&nmi_intc>; - interrupts = <0 8>; - - interrupt-controller; - #interrupt-cells = <1>; - }; - }; - - i2c2: i2c@01c2b400 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c2_pins_a>; - status = "okay"; - }; - - gmac: ethernet@01c50000 { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; - }; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_bananapi>; - - green { - label = "bananapi:green:usr"; - gpios = <&pio 7 24 0>; - }; - }; - - reg_usb1_vbus: usb1-vbus { - status = "okay"; - }; - - reg_usb2_vbus: usb2-vbus { - status = "okay"; - }; - - reg_gmac_3v3: gmac-3v3 { - compatible = "regulator-fixed"; - pinctrl-names = "default"; - pinctrl-0 = <&gmac_power_pin_bananapi>; - regulator-name = "gmac-3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - startup-delay-us = <100000>; - enable-active-high; - gpio = <&pio 7 22 23 0>; - }; -}; diff --git a/patch/devices/sun7i-a20-pcduino3-nano.dts b/patch/devices/sun7i-a20-pcduino3-nano.dts deleted file mode 100644 index fe2aadbed..000000000 --- a/patch/devices/sun7i-a20-pcduino3-nano.dts +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2015 Adam Sampson - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This file 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 file 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 file; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; -#include "sun7i-a20.dtsi" -#include "sunxi-common-regulators.dtsi" -#include -#include - -/ { - model = "LinkSprite pcDuino3 Nano"; - compatible = "linksprite,pcduino3-nano", "allwinner,sun7i-a20"; - - leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_pins_pcduino3_nano>; - - /* Marked "LED3" on the PCB. */ - usr1 { - label = "pcduino3-nano:green:usr1"; - gpios = <&pio 7 16 GPIO_ACTIVE_LOW>; /* PH16 */ - }; - - /* Marked "LED4" on the PCB. */ - usr2 { - label = "pcduino3-nano:green:usr2"; - gpios = <&pio 7 15 GPIO_ACTIVE_LOW>; /* PH15 */ - }; - }; -}; - -&ahci { - target-supply = <®_ahci_5v>; - status = "okay"; -}; - -&ehci0 { - status = "okay"; -}; - -&ehci1 { - status = "okay"; -}; - -&gmac { - pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_rgmii_a>; - phy = <&phy1>; - phy-mode = "rgmii"; - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - }; -}; - -&i2c0 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins_a>; - status = "okay"; - - axp209: pmic@34 { - compatible = "x-powers,axp209"; - reg = <0x34>; - interrupt-parent = <&nmi_intc>; - interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - - interrupt-controller; - #interrupt-cells = <1>; - }; -}; - -&ir0 { - pinctrl-names = "default"; - pinctrl-0 = <&ir0_pins_a>; - status = "okay"; -}; - -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ - cd-inverted; - status = "okay"; -}; - -&ohci0 { - status = "okay"; -}; - -&ohci1 { - status = "okay"; -}; - -&pio { - ahci_pwr_pin_pcduino3_nano: ahci_pwr_pin@0 { - allwinner,pins = "PH2"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - led_pins_pcduino3_nano: led_pins@0 { - allwinner,pins = "PH16", "PH15"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; - - usb1_vbus_pin_pcduino3_nano: usb1_vbus_pin@0 { - allwinner,pins = "PH11"; - allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; - }; -}; - -®_ahci_5v { - pinctrl-0 = <&ahci_pwr_pin_pcduino3_nano>; - gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */ - status = "okay"; -}; - -®_usb1_vbus { - pinctrl-0 = <&usb1_vbus_pin_pcduino3_nano>; - gpio = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ - status = "okay"; -}; - -®_usb2_vbus { - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; -}; - -&usbphy { - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb2_vbus>; - status = "okay"; -}; diff --git a/patch/kernel/0001-ARM-sun5i-dt-Add-Security-System-to-A10s-SoC-DTS.patch b/patch/kernel/0001-ARM-sun5i-dt-Add-Security-System-to-A10s-SoC-DTS.patch deleted file mode 100644 index d26722294..000000000 --- a/patch/kernel/0001-ARM-sun5i-dt-Add-Security-System-to-A10s-SoC-DTS.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 15eb60db598930b0a653d056c13bffb614ab2db7 Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Wed, 22 Apr 2015 14:33:29 +0200 -Subject: [PATCH 1/8] ARM: sun5i: dt: Add Security System to A10s SoC DTS - -The Security System is a hardware cryptographic accelerator that support -AES/MD5/SHA1/DES/3DES/PRNG algorithms. -It could be found on many Allwinner SoC. - -This patch enable the Security System on Allwinner A10s SoC Device-tree. - -Signed-off-by: LABBE Corentin ---- - arch/arm/boot/dts/sun5i-a10s.dtsi | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi -index 2fd8988..dbe8704 100644 ---- a/arch/arm/boot/dts/sun5i-a10s.dtsi -+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi -@@ -448,6 +448,14 @@ - status = "disabled"; - }; - -+ crypto: crypto-engine@01c15000 { -+ compatible = "allwinner,sun4i-a10-crypto"; -+ reg = <0x01c15000 0x1000>; -+ interrupts = <86>; -+ clocks = <&ahb_gates 5>, <&ss_clk>; -+ clock-names = "ahb", "mod"; -+ }; -+ - spi2: spi@01c17000 { - compatible = "allwinner,sun4i-a10-spi"; - reg = <0x01c17000 0x1000>; --- -2.3.6 - diff --git a/patch/kernel/0001-I2S-module-rework.patch b/patch/kernel/0001-I2S-module-rework.patch deleted file mode 100644 index 4109b1ea0..000000000 --- a/patch/kernel/0001-I2S-module-rework.patch +++ /dev/null @@ -1,1143 +0,0 @@ -From 9aec2b8e002ec3fd7664ec0c6b9ec608067bdde8 Mon Sep 17 00:00:00 2001 -From: nikkov -Date: Wed, 19 Mar 2014 17:17:53 +0700 -Subject: [PATCH] I2S module rework - ---- - sound/soc/Kconfig | 2 +- - sound/soc/sunxi/i2s/Kconfig | 2 +- - sound/soc/sunxi/i2s/sndi2s.c | 68 ++++++++-- - sound/soc/sunxi/i2s/sndi2s.h | 3 + - sound/soc/sunxi/i2s/sunxi-i2s.c | 279 ++++++++++++++++++++++++++++-------- - sound/soc/sunxi/i2s/sunxi-i2s.h | 9 +- - sound/soc/sunxi/i2s/sunxi-i2sdma.c | 36 +++++- - sound/soc/sunxi/i2s/sunxi-i2sdma.h | 4 +- - sound/soc/sunxi/i2s/sunxi-sndi2s.c | 135 ++++++++++++++++-- - sound/soc/sunxi/i2s/sunxi-sndi2s.h | 3 +- - 10 files changed, 446 insertions(+), 95 deletions(-) - -diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig -index adafead..2334cab 100644 ---- a/sound/soc/Kconfig -+++ b/sound/soc/Kconfig -@@ -60,7 +60,7 @@ source "sound/soc/sunxi/Kconfig" - source "sound/soc/sunxi/hdmiaudio/Kconfig" - source "sound/soc/sunxi/spdif/Kconfig" - # i2s needs various adjustments for sun7i --if ARCH_SUN4I || ARCH_SUN5I -+if ARCH_SUN4I || ARCH_SUN5I || ARCH_SUN7I - source "sound/soc/sunxi/i2s/Kconfig" - endif - endif -diff --git a/sound/soc/sunxi/i2s/Kconfig b/sound/soc/sunxi/i2s/Kconfig -index a6dff42..f244faa 100644 ---- a/sound/soc/sunxi/i2s/Kconfig -+++ b/sound/soc/sunxi/i2s/Kconfig -@@ -1,5 +1,5 @@ - config SND_SUNXI_SOC_I2S_INTERFACE -- tristate "SoC i2s interface for the AllWinner sun4i and sun5i chips" -+ tristate "SoC i2s interface for the AllWinner sun4i, sun5i and sun7i chips" - default m - help - Say Y or M if you want to add support for codecs attached to -diff --git a/sound/soc/sunxi/i2s/sndi2s.c b/sound/soc/sunxi/i2s/sndi2s.c -index 68bad02..f07129e 100644 ---- a/sound/soc/sunxi/i2s/sndi2s.c -+++ b/sound/soc/sunxi/i2s/sndi2s.c -@@ -35,11 +35,23 @@ struct sndi2s_priv { - }; - - static int i2s_used = 0; --#define sndi2s_RATES (SNDRV_PCM_RATE_8000_192000|SNDRV_PCM_RATE_KNOT) -+static int sunxi_i2s_slave = 0; -+ -+#define sndi2s_RATES_MASTER (SNDRV_PCM_RATE_8000_192000|SNDRV_PCM_RATE_KNOT) -+#define sndi2s_RATES_SLAVE (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ -+ SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |\ -+ SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000) -+ -+#if defined CONFIG_ARCH_SUN7I -+#define sndi2s_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) -+#else - #define sndi2s_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | \ -- SNDRV_PCM_FMTBIT_S18_3LE | SNDRV_PCM_FMTBIT_S20_3LE) -+ SNDRV_PCM_FMTBIT_S18_3LE | SNDRV_PCM_FMTBIT_S20_LE) -+#endif - -+/* cleaning code - hdmi_audio_t hdmi_parameter; -+*/ - - static int sndi2s_mute(struct snd_soc_dai *dai, int mute) - { -@@ -62,8 +74,26 @@ static int sndi2s_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) - { -+/* -+ switch (params_format(params)) -+ { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ printk("[IIS-0] sndi2s_hw_params: format 16 bit\n"); -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ printk("[IIS-0] sndi2s_hw_params: format 20 bit in 3 bytes\n"); -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ printk("[IIS-0] sndi2s_hw_params: format 24 bit in 4 bytes\n"); -+ break; -+ default: -+ printk("[IIS-0] sndi2s_hw_params: Unsupported format (%d)\n", (int)params_format(params)); -+ //return -EINVAL; -+ } -+*/ -+/* cleaning code - hdmi_parameter.sample_rate = params_rate(params); -- -+*/ - return 0; - } - -@@ -75,15 +105,18 @@ static int sndi2s_set_dai_sysclk(struct snd_soc_dai *codec_dai, - - static int sndi2s_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) - { -- -+/* cleaning code - hdmi_parameter.fs_between = div; -- -+*/ - return 0; - } - - static int sndi2s_set_dai_fmt(struct snd_soc_dai *codec_dai, - unsigned int fmt) - { -+/* -+ printk("[IIS-0] sndi2s_set_dai_fmt: format (%u)\n", fmt); -+*/ - return 0; - } - -@@ -104,7 +137,7 @@ struct snd_soc_dai_driver sndi2s_dai = { - .stream_name = "Playback", - .channels_min = 1, - .channels_max = 2, -- .rates = sndi2s_RATES, -+ .rates = sndi2s_RATES_MASTER, - .formats = sndi2s_FORMATS, - }, - /* pcm operations */ -@@ -129,10 +162,8 @@ static int sndi2s_soc_probe(struct snd_soc_codec *codec) - /* power down chip */ - static int sndi2s_soc_remove(struct snd_soc_codec *codec) - { -- struct sndhdmi_priv *sndi2s = snd_soc_codec_get_drvdata(codec); -- -+ struct sndi2s_priv *sndi2s = snd_soc_codec_get_drvdata(codec); - kfree(sndi2s); -- - return 0; - } - -@@ -143,6 +174,12 @@ static struct snd_soc_codec_driver soc_codec_dev_sndi2s = { - - static int __devinit sndi2s_codec_probe(struct platform_device *pdev) - { -+ if(sunxi_i2s_slave) { -+ sndi2s_dai.playback.rates = sndi2s_RATES_SLAVE; -+ printk("[I2S-0] sndi2s_codec_probe I2S used in slave mode\n"); -+ } -+ else -+ printk("[I2S-0] sndi2s_codec_probe I2S used in master mode\n"); - return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_sndi2s, &sndi2s_dai, 1); - } - -@@ -169,7 +206,7 @@ static struct platform_driver sndi2s_codec_driver = { - static int __init sndi2s_codec_init(void) - { - int err = 0; -- int ret = 0; -+ int ret = 0, i2s_slave = 0; - - ret = script_parser_fetch("i2s_para","i2s_used", &i2s_used, sizeof(int)); - if (ret) { -@@ -177,6 +214,16 @@ static int __init sndi2s_codec_init(void) - } - - if (i2s_used) { -+ ret = script_parser_fetch("i2s_para","i2s_slave", &i2s_slave, sizeof(int)); -+ if(ret == 0 && i2s_slave == 1) { -+ sunxi_i2s_slave = 1; -+ printk("[I2S-0] sndi2s_codec_init I2S used in slave mode\n"); -+ } -+ else { -+ sunxi_i2s_slave = 0; -+ printk("[I2S-0] sndi2s_codec_init I2S used in master mode\n"); -+ } -+ - if((err = platform_device_register(&sndi2s_codec_device)) < 0) - return err; - -@@ -204,3 +251,4 @@ MODULE_DESCRIPTION("SNDI2S ALSA soc codec driver"); - MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin "); - MODULE_LICENSE("GPL"); - MODULE_ALIAS("platform:sunxi-i2s-codec"); -+ -diff --git a/sound/soc/sunxi/i2s/sndi2s.h b/sound/soc/sunxi/i2s/sndi2s.h -index e5b95c8..57e2aa5 100644 ---- a/sound/soc/sunxi/i2s/sndi2s.h -+++ b/sound/soc/sunxi/i2s/sndi2s.h -@@ -16,6 +16,8 @@ - #ifndef SNDI2S_H_ - #define SNDI2S_H_ - -+#if 0 -+cleaning code - typedef struct hdmi_audio - { - __u8 hw_intf; /* 0:iis 1:spdif 2:pcm */ -@@ -54,5 +56,6 @@ typedef enum tag_HDMI_CMD - HDMI_CMD_AUDIO_ENABLE, - HDMI_CMD_GET_HPD_STATUS, - }__hdmi_cmd_t; -+#endif - - #endif -diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c -index b4dd3ad..9f19991 100644 ---- a/sound/soc/sunxi/i2s/sunxi-i2s.c -+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c -@@ -58,13 +58,15 @@ static struct sunxi_dma_params sunxi_i2s_pcm_stereo_in = { - }; - - -- struct sunxi_i2s_info sunxi_iis; -+/* most of fields of this structure is never initialized and useless !!!*/ -+struct sunxi_i2s_info sunxi_iis; - static u32 i2s_handle = 0; -- static struct clk *i2s_apbclk, *i2s_pll2clk, *i2s_pllx8, *i2s_moduleclk; -+static struct clk *i2s_apbclk, *i2s_pll2clk, *i2s_pllx8, *i2s_moduleclk; - - void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on) - { - u32 reg_val; -+ /*printk("[I2S-0] sunxi_snd_txctrl_i2s\n");*/ - - reg_val = readl(sunxi_iis.regs + SUNXI_TXCHSEL); - reg_val &= ~0x7; -@@ -73,7 +75,7 @@ void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on) - - reg_val = readl(sunxi_iis.regs + SUNXI_TXCHMAP); - reg_val = 0; -- if (sunxi_is_sun4i()) { -+ if (sunxi_is_sun4i() || sunxi_is_sun7i()) { - if(substream->runtime->channels == 1) { - reg_val = 0x76543200; - } else { -@@ -89,7 +91,7 @@ void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on) - writel(reg_val, sunxi_iis.regs + SUNXI_TXCHMAP); - - reg_val = readl(sunxi_iis.regs + SUNXI_IISCTL); -- if (sunxi_is_sun4i()) { -+ if (sunxi_is_sun4i() || sunxi_is_sun7i()) { - reg_val &= ~SUNXI_IISCTL_SDO3EN; - reg_val &= ~SUNXI_IISCTL_SDO2EN; - reg_val &= ~SUNXI_IISCTL_SDO1EN; -@@ -146,6 +148,8 @@ void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on) - - //Global Enable Digital Audio Interface - reg_val = readl(sunxi_iis.regs + SUNXI_IISCTL); -+ if(sunxi_iis.slave) -+ reg_val |= SUNXI_IISCTL_MS; // 1: Slave! - reg_val |= SUNXI_IISCTL_GEN; - writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL); - -@@ -170,7 +174,7 @@ void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on) - void sunxi_snd_rxctrl_i2s(int on) - { - u32 reg_val; -- -+ /*printk("[I2S-0] sunxi_snd_rxctrl_i2s\n");*/ - //flush RX FIFO - reg_val = readl(sunxi_iis.regs + SUNXI_IISFCTL); - reg_val |= SUNXI_IISFCTL_FRX; -@@ -192,6 +196,8 @@ void sunxi_snd_rxctrl_i2s(int on) - - //Global Enable Digital Audio Interface - reg_val = readl(sunxi_iis.regs + SUNXI_IISCTL); -+ if(sunxi_iis.slave) -+ reg_val |= SUNXI_IISCTL_MS; // 1: Slave! - reg_val |= SUNXI_IISCTL_GEN; - writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL); - -@@ -201,7 +207,7 @@ void sunxi_snd_rxctrl_i2s(int on) - reg_val &= ~SUNXI_IISCTL_RXEN; - writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL); - -- /* DISBALE dma DRQ mode */ -+ /* DISABLE dma DRQ mode */ - reg_val = readl(sunxi_iis.regs + SUNXI_IISINT); - reg_val &= ~SUNXI_IISINT_RXDRQEN; - writel(reg_val, sunxi_iis.regs + SUNXI_IISINT); -@@ -213,11 +219,13 @@ void sunxi_snd_rxctrl_i2s(int on) - } - } - -+//not used -+/* - static inline int sunxi_snd_is_clkmaster(void) - { - return ((readl(sunxi_iis.regs + SUNXI_IISCTL) & SUNXI_IISCTL_MS) ? 0 : 1); - } -- -+*/ - static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) - { - u32 reg_val; -@@ -225,7 +233,7 @@ static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) - - //SDO ON - reg_val = readl(sunxi_iis.regs + SUNXI_IISCTL); -- if (sunxi_is_sun4i()) { -+ if (sunxi_is_sun4i() || sunxi_is_sun7i()) { - reg_val |= (SUNXI_IISCTL_SDO0EN | SUNXI_IISCTL_SDO1EN | - SUNXI_IISCTL_SDO2EN | SUNXI_IISCTL_SDO3EN); - } else { -@@ -235,16 +243,31 @@ static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) - - /* master or slave selection */ - reg_val = readl(sunxi_iis.regs + SUNXI_IISCTL); -+ if(sunxi_iis.slave) -+ { -+ reg_val |= SUNXI_IISCTL_MS; // 1: Slave! -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set slave mode for I2S interface\n");*/ -+ } -+ else -+ { -+ reg_val &= ~SUNXI_IISCTL_MS; // 0: Master! -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set master mode for I2S interface\n");*/ -+ } -+/* - switch(fmt & SND_SOC_DAIFMT_MASTER_MASK){ -- case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master */ -- reg_val |= SUNXI_IISCTL_MS; -+ case SND_SOC_DAIFMT_CBS_CFS: // codec clk & frm slave -+ reg_val |= SUNXI_IISCTL_MS; // 1: Slave! -+ printk("[IIS-0] sunxi_i2s_set_fmt: set slave mode for I2S interface\n"); - break; -- case SND_SOC_DAIFMT_CBS_CFS: /* codec clk & frm slave */ -- reg_val &= ~SUNXI_IISCTL_MS; -+ case SND_SOC_DAIFMT_CBM_CFM: // codec clk & frm master -+ reg_val &= ~SUNXI_IISCTL_MS; // 0: Master! -+ printk("[IIS-0] sunxi_i2s_set_fmt: set master mode for I2S interface\n"); - break; - default: -+ printk("[IIS-0] sunxi_i2s_set_fmt: not master or slave mode\n"); - return -EINVAL; - } -+*/ - writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL); - - /* pcm or i2s mode selection */ -@@ -255,24 +278,30 @@ static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) - case SND_SOC_DAIFMT_I2S: /* I2S mode */ - reg_val &= ~SUNXI_IISCTL_PCM; - reg_val1 |= SUNXI_IISFAT0_FMT_I2S; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set I2S mode\n");*/ - break; - case SND_SOC_DAIFMT_RIGHT_J: /* Right Justified mode */ - reg_val &= ~SUNXI_IISCTL_PCM; - reg_val1 |= SUNXI_IISFAT0_FMT_RGT; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set Right Justified mode\n");*/ - break; - case SND_SOC_DAIFMT_LEFT_J: /* Left Justified mode */ - reg_val &= ~SUNXI_IISCTL_PCM; - reg_val1 |= SUNXI_IISFAT0_FMT_LFT; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set Left Justified mode\n");*/ - break; - case SND_SOC_DAIFMT_DSP_A: /* L data msb after FRM LRC */ - reg_val |= SUNXI_IISCTL_PCM; - reg_val1 &= ~SUNXI_IISFAT0_LRCP; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set L data msb after FRM LRC mode\n");*/ - break; - case SND_SOC_DAIFMT_DSP_B: /* L data msb during FRM LRC */ - reg_val |= SUNXI_IISCTL_PCM; - reg_val1 |= SUNXI_IISFAT0_LRCP; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set L data msb during FRM LRC mode\n");*/ - break; - default: -+ printk("[IIS-0] sunxi_i2s_set_fmt: unknown mode\n"); - return -EINVAL; - } - writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL); -@@ -284,25 +313,30 @@ static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) - case SND_SOC_DAIFMT_NB_NF: /* normal bit clock + frame */ - reg_val1 &= ~SUNXI_IISFAT0_LRCP; - reg_val1 &= ~SUNXI_IISFAT0_BCP; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: normal bit clock + frame\n");*/ - break; - case SND_SOC_DAIFMT_NB_IF: /* normal bclk + inv frm */ - reg_val1 |= SUNXI_IISFAT0_LRCP; - reg_val1 &= ~SUNXI_IISFAT0_BCP; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: normal bclk + inv frm\n");*/ - break; - case SND_SOC_DAIFMT_IB_NF: /* invert bclk + nor frm */ - reg_val1 &= ~SUNXI_IISFAT0_LRCP; - reg_val1 |= SUNXI_IISFAT0_BCP; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: invert bclk + nor frm\n");*/ - break; - case SND_SOC_DAIFMT_IB_IF: /* invert bclk + frm */ - reg_val1 |= SUNXI_IISFAT0_LRCP; - reg_val1 |= SUNXI_IISFAT0_BCP; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: invert bclk + frm\n");*/ - break; - } - writel(reg_val1, sunxi_iis.regs + SUNXI_IISFAT0); - -- /* word select size */ -+ /* clear word select size */ - reg_val = readl(sunxi_iis.regs + SUNXI_IISFAT0); - reg_val &= ~SUNXI_IISFAT0_WSS_32BCLK; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: word size = %d\n", sunxi_iis.ws_size);*/ - if(sunxi_iis.ws_size == 16) - reg_val |= SUNXI_IISFAT0_WSS_16BCLK; - else if(sunxi_iis.ws_size == 20) -@@ -318,9 +352,15 @@ static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) - reg_val |= sunxi_iis.pcm_rxtype<<2; - - if(!sunxi_iis.pcm_sync_type) -+ { - reg_val |= SUNXI_IISFAT1_SSYNC; //short sync -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: set pcm_sync_type = short sync\n");*/ -+ } - if(sunxi_iis.pcm_sw == 16) -+ { - reg_val |= SUNXI_IISFAT1_SW; -+ /*printk("[IIS-0] sunxi_i2s_set_fmt: pcm_sw == 16\n");*/ -+ } - - reg_val |=((sunxi_iis.pcm_start_slot - 1)&0x3)<<6; //start slot index - -@@ -349,6 +389,7 @@ static int sunxi_i2s_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) - { -+ u32 reg_val; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct sunxi_dma_params *dma_data; - -@@ -358,6 +399,31 @@ static int sunxi_i2s_hw_params(struct snd_pcm_substream *substream, - else - dma_data = &sunxi_i2s_pcm_stereo_in; - -+ /* set format info */ -+ reg_val = readl(sunxi_iis.regs + SUNXI_IISFAT0); -+ /* clear sample resolution select size */ -+ reg_val &= ~SUNXI_IISFAT0_SR_RVD; -+ -+ switch (params_format(params)) -+ { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ reg_val |= SUNXI_IISFAT0_SR_16BIT; -+ /*printk("[IIS-0] sunxi_i2s_hw_params: format 16 bit\n");*/ -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ reg_val |= SUNXI_IISFAT0_SR_20BIT; -+ /*printk("[IIS-0] sunxi_i2s_hw_params: format 20 bit\n");*/ -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ reg_val |= SUNXI_IISFAT0_SR_24BIT; -+ /*printk("[IIS-0] sunxi_i2s_hw_params: format 24 bit\n");*/ -+ break; -+ default: -+ printk("[IIS-0] sunxi_i2s_hw_params: Unsupported format (%d)\n", (int)params_format(params)); -+ //return -EINVAL; -+ } -+ writel(reg_val, sunxi_iis.regs + SUNXI_IISFAT0); -+ - snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data); - return 0; - } -@@ -403,9 +469,17 @@ static int sunxi_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, - unsigned int freq, int dir) - { - if (!freq) { -- clk_set_rate(i2s_pll2clk, 24576000); -+ /*printk("[IIS-0] sunxi_i2s_set_sysclk: set sysclk=24576000\n");*/ -+ if(sunxi_iis.slave) -+ gpio_write_one_pin_value(i2s_handle, 0, "i2s_clk_sel"); -+ else -+ clk_set_rate(i2s_pll2clk, 24576000); - } else { -- clk_set_rate(i2s_pll2clk, 22579200); -+ /*printk("[IIS-0] sunxi_i2s_set_sysclk: set sysclk=22579200\n");*/ -+ if(sunxi_iis.slave) -+ gpio_write_one_pin_value(i2s_handle, 1, "i2s_clk_sel"); -+ else -+ clk_set_rate(i2s_pll2clk, 22579200); - } - - return 0; -@@ -414,6 +488,27 @@ static int sunxi_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, - static int sunxi_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, int div_id, int div) - { - u32 reg; -+ /*printk("[IIS-0] sunxi_i2s_set_clkdiv: PLL clock div_id=(%s), div=(%d)\n", -+ div_id == SUNXI_DIV_MCLK ? "SUNXI_DIV_MCLK" : -+ (div_id == SUNXI_DIV_BCLK ? "SUNXI_DIV_BCLK" : "SUNXI_DIV_EXTCLK"), div);*/ -+ -+ -+ if(sunxi_iis.slave) { -+ if(div_id != SUNXI_DIV_EXTCLK) { -+ pr_err("[I2S-0] try to set external clock divider failed\n"); -+ return -EINVAL; -+ } -+ /*printk("[IIS-0] sunxi_i2s_set_clkdiv: external clock, div=(%d)\n", div);*/ -+ } -+ else { -+ if(div_id != SUNXI_DIV_MCLK && div_id != SUNXI_DIV_BCLK) { -+ pr_err("[I2S-0] try to set PLL clock divider failed\n"); -+ return -EINVAL; -+ } -+ /*printk("[IIS-0] sunxi_i2s_set_clkdiv: PLL clock div_id=(%s), div=(%d)\n", -+ div_id == SUNXI_DIV_MCLK ? "SUNXI_DIV_MCLK" : "SUNXI_DIV_BCLK", div);*/ -+ } -+ - switch (div_id) { - case SUNXI_DIV_MCLK: - if(div <= 8) -@@ -447,18 +542,39 @@ static int sunxi_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, int div_id, int div - reg = (readl(sunxi_iis.regs + SUNXI_IISCLKD) & ~SUNXI_IISCLKD_BCLK_MASK) | (div <params == NULL) { - prtd->params = dma; - ret = sunxi_dma_request(prtd->params, 0); -@@ -196,10 +214,22 @@ static int sunxi_pcm_prepare(struct snd_pcm_substream *substream) - #else - dma_config_t codec_dma_conf; - memset(&codec_dma_conf, 0, sizeof(codec_dma_conf)); -- codec_dma_conf.xfer_type.src_data_width = DATA_WIDTH_16BIT; -+ -+ /*printk("[IIS-0] sunxi_pcm_prepare: DMA data width=(%d)\n", dma_width);*/ -+ if(dma_width > 16) -+ { -+ codec_dma_conf.xfer_type.src_data_width = DATA_WIDTH_32BIT; -+ codec_dma_conf.xfer_type.dst_data_width = DATA_WIDTH_32BIT; -+ } -+ else -+ { -+ codec_dma_conf.xfer_type.src_data_width = DATA_WIDTH_16BIT; -+ codec_dma_conf.xfer_type.dst_data_width = DATA_WIDTH_16BIT; -+ } - codec_dma_conf.xfer_type.src_bst_len = DATA_BRST_1; -- codec_dma_conf.xfer_type.dst_data_width = DATA_WIDTH_16BIT; -+// codec_dma_conf.xfer_type.src_bst_len = DATA_BRST_4; /*like SPDIF module?*/ - codec_dma_conf.xfer_type.dst_bst_len = DATA_BRST_1; -+// codec_dma_conf.xfer_type.src_bst_len = DATA_BRST_4; /*like SPDIF module?*/ - codec_dma_conf.address_type.src_addr_mode = NDMA_ADDR_INCREMENT; - codec_dma_conf.address_type.dst_addr_mode = NDMA_ADDR_NOCHANGE; - codec_dma_conf.src_drq_type = N_SRC_SDRAM; -diff --git a/sound/soc/sunxi/i2s/sunxi-i2sdma.h b/sound/soc/sunxi/i2s/sunxi-i2sdma.h -index 50418a58..8f0b029 100644 ---- a/sound/soc/sunxi/i2s/sunxi-i2sdma.h -+++ b/sound/soc/sunxi/i2s/sunxi-i2sdma.h -@@ -29,7 +29,7 @@ enum sunxi_dma_buffresult { - }; - - /* platform data */ --extern struct snd_soc_platform sunxi_soc_platform_i2s; --extern struct sunxi_i2s_info sunxi_iis; -+//extern struct snd_soc_platform sunxi_soc_platform_i2s; -+//extern struct sunxi_i2s_info sunxi_iis; - - #endif //SUNXI_PCM_H_ -diff --git a/sound/soc/sunxi/i2s/sunxi-sndi2s.c b/sound/soc/sunxi/i2s/sunxi-sndi2s.c -index 7c1a3d4..682c553 100644 ---- a/sound/soc/sunxi/i2s/sunxi-sndi2s.c -+++ b/sound/soc/sunxi/i2s/sunxi-sndi2s.c -@@ -29,9 +29,14 @@ - - #include "sndi2s.h" - -+/* cleaning code - static struct clk *xtal; - static int clk_users; - static DEFINE_MUTEX(clk_lock); -+*/ -+ -+/* slave mode flag*/ -+static int sunxi_i2s_slave = 0; - - #ifdef ENFORCE_RATES - static struct snd_pcm_hw_constraint_list hw_constraints_rates = { -@@ -62,6 +67,7 @@ static int sunxi_sndi2s_startup(struct snd_pcm_substream *substream) - - static void sunxi_sndi2s_shutdown(struct snd_pcm_substream *substream) - { -+/* cleaning code - mutex_lock(&clk_lock); - clk_users -= 1; - if (clk_users == 0) { -@@ -70,6 +76,7 @@ static void sunxi_sndi2s_shutdown(struct snd_pcm_substream *substream) - - } - mutex_unlock(&clk_lock); -+*/ - } - - typedef struct __MCLK_SET_INF -@@ -91,6 +98,14 @@ typedef struct __BCLK_SET_INF - - } __bclk_set_inf; - -+typedef struct __EXTCLK_SET_INF -+{ -+ __u32 samp_rate; // sample rate -+ __u16 clk_div; // masterclock division -+ __u16 mpll; // select mpll, 0 - 24.576 Mhz, 1 - 22.5792 Mhz -+ -+} __extclk_set_inf; -+ - - static __bclk_set_inf BCLK_INF[] = - { -@@ -164,7 +179,45 @@ static __mclk_set_inf MCLK_INF[] = - {0xffffffff, 0, 0, 0}, - }; - --static s32 get_clock_divder(u32 sample_rate, u32 sample_width, u32 * mclk_div, u32* mpll, u32* bclk_div, u32* mult_fs) -+static __extclk_set_inf EXTCLK_INF[] = -+{ -+ //44.1k bitrate -+ { 44100, 512, 1}, -+ //48k bitrate -+ { 48000, 512, 0}, -+ //88.2k bitrate -+ { 88200, 256, 1}, -+ //96k bitrate -+ { 96000, 256, 0}, -+ //176.4k bitrate -+ { 176400, 128, 1}, -+ //192k bitrate -+ { 192000, 128, 0}, -+ -+ //end flag 0xffffffff -+ {0xffffffff, 0, 0} -+}; -+ -+ -+static s32 get_clock_divder_slave(u32 sample_rate, u32 sample_width, u32* bclk_div, u32* mpll, u32* mult_fs) -+{ -+ u32 i, ret = -EINVAL; -+ -+ for(i=0; i< 100; i++) { -+ if(EXTCLK_INF[i].samp_rate == sample_rate) { -+ //set mpll and bclk division -+ *mpll = EXTCLK_INF[i].mpll; -+ *bclk_div = EXTCLK_INF[i].clk_div; -+ ret = 0; -+ break; -+ } -+ else if(EXTCLK_INF[i].samp_rate == 0xffffffff) -+ break; -+ } -+ return ret; -+} -+ -+static s32 get_clock_divder_master(u32 sample_rate, u32 sample_width, u32 * mclk_div, u32* mpll, u32* bclk_div, u32* mult_fs) - { - u32 i, j, ret = -EINVAL; - -@@ -200,35 +253,77 @@ static int sunxi_sndi2s_hw_params(struct snd_pcm_substream *substream, - int ret = 0; - unsigned long rate = params_rate(params); - u32 mclk_div=0, mpll=0, bclk_div=0, mult_fs=0; -+/* -+ printk("[IIS-0] sunxi_sndi2s_hw_params: codec_dai=(%s), cpu_dai=(%s)\n", codec_dai->name, cpu_dai->name); -+ printk("[IIS-0] sunxi_sndi2s_hw_params: channel num=(%d)\n", params_channels(params)); -+ printk("[IIS-0] sunxi_sndi2s_hw_params: sample rate=(%lu)\n", rate); -+ -+ switch (params_format(params)) -+ { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ printk("[IIS-0] sunxi_sndi2s_hw_params: format 16 bit\n"); -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ printk("[IIS-0] sunxi_sndi2s_hw_params: format 20 bit in 3 bytes\n"); -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ printk("[IIS-0] sunxi_sndi2s_hw_params: format 24 bit in 4 bytes\n"); -+ break; -+ default: -+ printk("[IIS-0] sunxi_sndi2s_hw_params: Unsupported format (%d)\n", (int)params_format(params)); -+ //return -EINVAL; -+ } -+*/ -+ if(!sunxi_i2s_slave) { -+ get_clock_divder_master(rate, 32, &mclk_div, &mpll, &bclk_div, &mult_fs); -+ printk("[IIS-0] get_clock_divder_master: rate=(%lu), mclk_div=(%d), mpll=(%d), bclk_div=(%d), mult_fs=(%d)\n", -+ rate, mclk_div, mpll, bclk_div, mult_fs); -+ } else { -+ get_clock_divder_slave(rate, 32, &bclk_div, &mpll, &mult_fs); -+ printk("[IIS-0] get_clock_divder_slave: rate=(%lu), bclk_div=(%d), mpll=(%d), mult_fs=(%d)\n", -+ rate, bclk_div, mpll, mult_fs); -+ } - -- get_clock_divder(rate, 32, &mclk_div, &mpll, &bclk_div, &mult_fs); -- -+ //call sunxi_iis_set_fmt - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | -- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); -+ SND_SOC_DAIFMT_NB_NF/* | SND_SOC_DAIFMT_CBM_CFM*/); - if (ret < 0) - return ret; - -+ //call sunxi_iis_set_fmt - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | -- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); -+ SND_SOC_DAIFMT_NB_NF/* | SND_SOC_DAIFMT_CBM_CFM*/); - if (ret < 0) - return ret; - -+ //call sunxi_iis_set_sysclk - ret = snd_soc_dai_set_sysclk(cpu_dai, 0 , mpll, 0); - if (ret < 0) - return ret; - -+ //call sndi2s_set_dai_sysclk - ret = snd_soc_dai_set_sysclk(codec_dai, 0 , mpll, 0); - if (ret < 0) - return ret; - -- ret = snd_soc_dai_set_clkdiv(cpu_dai, SUNXI_DIV_MCLK, mclk_div); -- if (ret < 0) -- return ret; -+ if(!sunxi_i2s_slave) { -+ //call sunxi_iis_set_clkdiv -+ ret = snd_soc_dai_set_clkdiv(cpu_dai, SUNXI_DIV_MCLK, mclk_div); -+ if (ret < 0) -+ return ret; - -- ret = snd_soc_dai_set_clkdiv(cpu_dai, SUNXI_DIV_BCLK, bclk_div); -- if (ret < 0) -- return ret; -+ //call sunxi_iis_set_clkdiv -+ ret = snd_soc_dai_set_clkdiv(cpu_dai, SUNXI_DIV_BCLK, bclk_div); -+ if (ret < 0) -+ return ret; -+ } else { -+ //call sunxi_iis_set_clkdiv -+ ret = snd_soc_dai_set_clkdiv(cpu_dai, SUNXI_DIV_EXTCLK, bclk_div); -+ if (ret < 0) -+ return ret; -+ } - -+ //call sndi2s_set_dai_clkdiv - ret = snd_soc_dai_set_clkdiv(codec_dai, 0, mult_fs); - if (ret < 0) - return ret; -@@ -243,7 +338,7 @@ static struct snd_soc_ops sunxi_sndi2s_ops = { - }; - - static struct snd_soc_dai_link sunxi_sndi2s_dai_link = { -- .name = "I2S", -+ .name = "I2S", - .stream_name = "SUNXI-I2S", - .cpu_dai_name = "sunxi-i2s.0", - .codec_dai_name = "sndi2s", -@@ -286,12 +381,26 @@ static struct platform_driver sunxi_sndi2s_driver = { - - static int __init sunxi_sndi2s_init(void) - { -- int ret, i2s_used = 0; -+ int ret, i2s_used = 0, i2s_slave = 0; -+ -+ printk("[IIS]Entered %s\n", __func__); - - ret = script_parser_fetch("i2s_para", "i2s_used", &i2s_used, 1); - if (ret != 0 || !i2s_used) - return -ENODEV; - -+ script_parser_fetch("i2s_para","i2s_slave", &i2s_slave, sizeof(int)); -+ if (i2s_slave) -+ { -+ sunxi_i2s_slave = 1; -+ printk("[I2S-0] sunxi_sndi2s_init I2S used in slave mode\n"); -+ } -+ else -+ { -+ sunxi_i2s_slave = 0; -+ printk("[I2S-0] sunxi_sndi2s_init I2S used in master mode\n"); -+ } -+ - ret = platform_device_register(&sunxi_sndi2s_device); - if (ret < 0) - return ret; -diff --git a/sound/soc/sunxi/i2s/sunxi-sndi2s.h b/sound/soc/sunxi/i2s/sunxi-sndi2s.h -index 47f0961..89cc71a 100644 ---- a/sound/soc/sunxi/i2s/sunxi-sndi2s.h -+++ b/sound/soc/sunxi/i2s/sunxi-sndi2s.h -@@ -14,7 +14,7 @@ - */ - #ifndef SUNXI_SNDI2S_H_ - #define SUNXI_SNDI2S_H_ -- -+/* cleaning code - struct sunxi_sndi2s_platform_data { - int iis_bclk; - int iis_ws; -@@ -22,4 +22,5 @@ struct sunxi_sndi2s_platform_data { - void (*power)(int); - int model; - } -+*/ - #endif --- -1.7.7.1.msysgit.0 - diff --git a/patch/kernel/0002-ARM-sun6i-dt-Add-Security-System-to-A31-SoC-DTS.patch b/patch/kernel/0002-ARM-sun6i-dt-Add-Security-System-to-A31-SoC-DTS.patch deleted file mode 100644 index f2e0ba809..000000000 --- a/patch/kernel/0002-ARM-sun6i-dt-Add-Security-System-to-A31-SoC-DTS.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 4c4c51f19c975948b3a43d10606e075ca2254f74 Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Fri, 17 Apr 2015 13:25:34 +0200 -Subject: [PATCH 2/8] ARM: sun6i: dt: Add Security System to A31 SoC DTS - -The Security System is a hardware cryptographic accelerator that support -AES/MD5/SHA1/DES/3DES/PRNG algorithms. -It could be found on many Allwinner SoC. - -This patch enable the Security System on the Allwinner A31 SoC Device-tree. - -Signed-off-by: LABBE Corentin ---- - arch/arm/boot/dts/sun6i-a31.dtsi | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi -index fa2f403..6b300f4 100644 ---- a/arch/arm/boot/dts/sun6i-a31.dtsi -+++ b/arch/arm/boot/dts/sun6i-a31.dtsi -@@ -296,6 +296,14 @@ - "mmc3_sample"; - }; - -+ ss_clk: clk@01c2009c { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-mod0-clk"; -+ reg = <0x01c2009c 0x4>; -+ clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; -+ clock-output-names = "ss"; -+ }; -+ - spi0_clk: clk@01c200a0 { - #clock-cells = <0>; - compatible = "allwinner,sun4i-a10-mod0-clk"; -@@ -455,6 +463,14 @@ - status = "disabled"; - }; - -+ crypto: crypto-engine@01c15000 { -+ compatible = "allwinner,sun4i-a10-crypto"; -+ reg = <0x01c15000 0x1000>; -+ interrupts = ; -+ clocks = <&ahb_gates 5>, <&ss_clk>; -+ clock-names = "ahb", "mod"; -+ }; -+ - usbphy: phy@01c19400 { - compatible = "allwinner,sun6i-a31-usb-phy"; - reg = <0x01c19400 0x10>, --- -2.3.6 - diff --git a/patch/kernel/0003-ARM-sun4i-dt-Add-Security-System-to-A10-SoC-DTS.patch b/patch/kernel/0003-ARM-sun4i-dt-Add-Security-System-to-A10-SoC-DTS.patch deleted file mode 100644 index e489e5265..000000000 --- a/patch/kernel/0003-ARM-sun4i-dt-Add-Security-System-to-A10-SoC-DTS.patch +++ /dev/null @@ -1,38 +0,0 @@ -From d2a3003bba47ebab67252992f533f1f957666f2a Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Wed, 22 Apr 2015 14:16:08 +0200 -Subject: [PATCH 3/8] ARM: sun4i: dt: Add Security System to A10 SoC DTS - -The Security System is a hardware cryptographic accelerator that support -AES/MD5/SHA1/DES/3DES/PRNG algorithms. -It could be found on many Allwinner SoC. - -This patch enable the Security System on the Allwinner A10 SoC Device-tree. - -Signed-off-by: LABBE Corentin ---- - arch/arm/boot/dts/sun4i-a10.dtsi | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi -index eebb785..bd7cdeb 100644 ---- a/arch/arm/boot/dts/sun4i-a10.dtsi -+++ b/arch/arm/boot/dts/sun4i-a10.dtsi -@@ -564,6 +564,14 @@ - status = "disabled"; - }; - -+ crypto: crypto-engine@01c15000 { -+ compatible = "allwinner,sun4i-a10-crypto"; -+ reg = <0x01c15000 0x1000>; -+ interrupts = <86>; -+ clocks = <&ahb_gates 5>, <&ss_clk>; -+ clock-names = "ahb", "mod"; -+ }; -+ - spi2: spi@01c17000 { - compatible = "allwinner,sun4i-a10-spi"; - reg = <0x01c17000 0x1000>; --- -2.3.6 - diff --git a/patch/kernel/0004-ARM-sun7i-dt-Add-Security-System-to-A20-SoC-DTS.patch b/patch/kernel/0004-ARM-sun7i-dt-Add-Security-System-to-A20-SoC-DTS.patch deleted file mode 100644 index a5cd3476f..000000000 --- a/patch/kernel/0004-ARM-sun7i-dt-Add-Security-System-to-A20-SoC-DTS.patch +++ /dev/null @@ -1,38 +0,0 @@ -From bc67b1914525bd0ea236255bc05598e2acf3ef59 Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Sat, 4 Oct 2014 14:18:07 +0200 -Subject: [PATCH 4/8] ARM: sun7i: dt: Add Security System to A20 SoC DTS - -The Security System is a hardware cryptographic accelerator that support -AES/MD5/SHA1/DES/3DES/PRNG algorithms. -It could be found on many Allwinner SoC. - -This patch enable the Security System on the Allwinner A20 SoC Device-tree. - -Signed-off-by: LABBE Corentin ---- - arch/arm/boot/dts/sun7i-a20.dtsi | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi -index fdd1817..e840d76 100644 ---- a/arch/arm/boot/dts/sun7i-a20.dtsi -+++ b/arch/arm/boot/dts/sun7i-a20.dtsi -@@ -679,6 +679,14 @@ - status = "disabled"; - }; - -+ crypto: crypto-engine@01c15000 { -+ compatible = "allwinner,sun4i-a10-crypto"; -+ reg = <0x01c15000 0x1000>; -+ interrupts = ; -+ clocks = <&ahb_gates 5>, <&ss_clk>; -+ clock-names = "ahb", "mod"; -+ }; -+ - spi2: spi@01c17000 { - compatible = "allwinner,sun4i-a10-spi"; - reg = <0x01c17000 0x1000>; --- -2.3.6 - diff --git a/patch/kernel/0005-ARM-sun4i-dt-Add-DT-bindings-documentation-for-SUN4I.patch b/patch/kernel/0005-ARM-sun4i-dt-Add-DT-bindings-documentation-for-SUN4I.patch deleted file mode 100644 index 003a25503..000000000 --- a/patch/kernel/0005-ARM-sun4i-dt-Add-DT-bindings-documentation-for-SUN4I.patch +++ /dev/null @@ -1,43 +0,0 @@ -From bda35d07f7fc2f755b1b8c44cd762391be60b44f Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Sat, 4 Oct 2014 14:19:41 +0200 -Subject: [PATCH 5/8] ARM: sun4i: dt: Add DT bindings documentation for SUN4I - Security System - -This patch adds documentation for Device-Tree bindings for the Security System -cryptographic accelerator driver. - -Signed-off-by: LABBE Corentin ---- - Documentation/devicetree/bindings/crypto/sun4i-ss.txt | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - create mode 100644 Documentation/devicetree/bindings/crypto/sun4i-ss.txt - -diff --git a/Documentation/devicetree/bindings/crypto/sun4i-ss.txt b/Documentation/devicetree/bindings/crypto/sun4i-ss.txt -new file mode 100644 -index 0000000..1e02d17 ---- /dev/null -+++ b/Documentation/devicetree/bindings/crypto/sun4i-ss.txt -@@ -0,0 +1,19 @@ -+* Allwinner Security System found on A20 SoC -+ -+Required properties: -+- compatible : Should be "allwinner,sun4i-a10-crypto". -+- reg: Should contain the Security System register location and length. -+- interrupts: Should contain the IRQ line for the Security System. -+- clocks : List of clock specifiers, corresponding to ahb and ss. -+- clock-names : Name of the functional clock, should be -+ * "ahb" : AHB gating clock -+ * "mod" : SS controller clock -+ -+Example: -+ crypto: crypto-engine@01c15000 { -+ compatible = "allwinner,sun4i-a10-crypto"; -+ reg = <0x01c15000 0x1000>; -+ interrupts = ; -+ clocks = <&ahb_gates 5>, <&ss_clk>; -+ clock-names = "ahb", "mod"; -+ }; --- -2.3.6 - diff --git a/patch/kernel/0006-crypto-Add-Allwinner-Security-System-crypto-accelera.patch b/patch/kernel/0006-crypto-Add-Allwinner-Security-System-crypto-accelera.patch deleted file mode 100644 index 9f86a5e2f..000000000 --- a/patch/kernel/0006-crypto-Add-Allwinner-Security-System-crypto-accelera.patch +++ /dev/null @@ -1,1717 +0,0 @@ -From 39ab54af71d9bbabf9b4538e84fbcca9cf552dc7 Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Sat, 4 Oct 2014 14:21:17 +0200 -Subject: [PATCH 6/8] crypto: Add Allwinner Security System crypto accelerator - -Add support for the Security System included in Allwinner SoC A20. -The Security System is a hardware cryptographic accelerator that support: -- MD5 and SHA1 hash algorithms -- AES block cipher in CBC/ECB mode with 128/196/256bits keys. -- DES and 3DES block cipher in CBC/ECB mode - -Signed-off-by: LABBE Corentin ---- - drivers/crypto/Kconfig | 17 + - drivers/crypto/Makefile | 1 + - drivers/crypto/sunxi-ss/Makefile | 2 + - drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 529 ++++++++++++++++++++++++++++++ - drivers/crypto/sunxi-ss/sun4i-ss-core.c | 395 ++++++++++++++++++++++ - drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 501 ++++++++++++++++++++++++++++ - drivers/crypto/sunxi-ss/sun4i-ss.h | 195 +++++++++++ - 7 files changed, 1640 insertions(+) - create mode 100644 drivers/crypto/sunxi-ss/Makefile - create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c - create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss-core.c - create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss-hash.c - create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss.h - -diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig -index 033c0c8..2a5598e 100644 ---- a/drivers/crypto/Kconfig -+++ b/drivers/crypto/Kconfig -@@ -459,4 +459,21 @@ config CRYPTO_DEV_IMGTEC_HASH - hardware hash accelerator. Supporting MD5/SHA1/SHA224/SHA256 - hashing algorithms. - -+config CRYPTO_DEV_SUN4I_SS -+ tristate "Support for Allwinner Security System cryptographic accelerator" -+ depends on ARCH_SUNXI -+ select CRYPTO_MD5 -+ select CRYPTO_SHA1 -+ select CRYPTO_AES -+ select CRYPTO_DES -+ select CRYPTO_BLKCIPHER -+ help -+ Some Allwinner SoC have a crypto accelerator named -+ Security System. Select this if you want to use it. -+ The Security System handle AES/DES/3DES ciphers in CBC mode -+ and SHA1 and MD5 hash algorithms. -+ -+ To compile this driver as a module, choose M here: the module -+ will be called sun4i-ss. -+ - endif # CRYPTO_HW -diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile -index fb84be7..e843292 100644 ---- a/drivers/crypto/Makefile -+++ b/drivers/crypto/Makefile -@@ -27,3 +27,4 @@ obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/ - obj-$(CONFIG_CRYPTO_DEV_QAT) += qat/ - obj-$(CONFIG_CRYPTO_DEV_QCE) += qce/ - obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/ -+obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sunxi-ss/ -diff --git a/drivers/crypto/sunxi-ss/Makefile b/drivers/crypto/sunxi-ss/Makefile -new file mode 100644 -index 0000000..8f4c7a2 ---- /dev/null -+++ b/drivers/crypto/sunxi-ss/Makefile -@@ -0,0 +1,2 @@ -+obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss.o -+sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c -new file mode 100644 -index 0000000..01634aa ---- /dev/null -+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c -@@ -0,0 +1,529 @@ -+/* -+ * sun4i-ss-cipher.c - hardware cryptographic accelerator for Allwinner A20 SoC -+ * -+ * Copyright (C) 2013-2015 Corentin LABBE -+ * -+ * This file add support for AES cipher with 128,192,256 bits -+ * keysize in CBC and ECB mode. -+ * Add support also for DES and 3DES in CBC and ECB mode. -+ * -+ * You could find the datasheet in Documentation/arm/sunxi/README -+ * -+ * 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 "sun4i-ss.h" -+ -+static int sun4i_ss_opti_poll(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_ss_ctx *ss = op->ss; -+ unsigned int ivsize = crypto_ablkcipher_ivsize(tfm); -+ struct sun4i_cipher_req_ctx *ctx = ablkcipher_request_ctx(areq); -+ u32 mode = ctx->mode; -+ /* when activating SS, the default FIFO space is 32 */ -+ u32 rx_cnt = 32; -+ u32 tx_cnt = 0; -+ u32 spaces; -+ u32 v; -+ int i, err = 0; -+ unsigned int ileft = areq->nbytes; -+ unsigned int oleft = areq->nbytes; -+ unsigned int todo; -+ struct sg_mapping_iter mi, mo; -+ unsigned int oi, oo; /* offset for in and out */ -+ -+ if (areq->nbytes == 0) -+ return 0; -+ -+ if (areq->info == NULL) { -+ dev_err(ss->dev, "ERROR: Empty IV\n"); -+ return -EINVAL; -+ } -+ -+ if (areq->src == NULL || areq->dst == NULL) { -+ dev_err(ss->dev, "ERROR: Some SGs are NULL\n"); -+ return -EINVAL; -+ } -+ -+ spin_lock_bh(&ss->slock); -+ -+ for (i = 0; i < op->keylen; i += 4) -+ writel(*(op->key + i / 4), ss->base + SS_KEY0 + i); -+ -+ if (areq->info != NULL) { -+ for (i = 0; i < 4 && i < ivsize / 4; i++) { -+ v = *(u32 *)(areq->info + i * 4); -+ writel(v, ss->base + SS_IV0 + i * 4); -+ } -+ } -+ writel(mode, ss->base + SS_CTL); -+ -+ sg_miter_start(&mi, areq->src, sg_nents(areq->src), -+ SG_MITER_FROM_SG | SG_MITER_ATOMIC); -+ sg_miter_start(&mo, areq->dst, sg_nents(areq->dst), -+ SG_MITER_TO_SG | SG_MITER_ATOMIC); -+ sg_miter_next(&mi); -+ sg_miter_next(&mo); -+ if (mi.addr == NULL || mo.addr == NULL) { -+ dev_err(ss->dev, "ERROR: sg_miter return null\n"); -+ err = -EINVAL; -+ goto release_ss; -+ } -+ -+ ileft = areq->nbytes / 4; -+ oleft = areq->nbytes / 4; -+ oi = 0; -+ oo = 0; -+ do { -+ todo = min3(rx_cnt, ileft, (mi.length - oi) / 4); -+ if (todo > 0) { -+ ileft -= todo; -+ writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo); -+ oi += todo * 4; -+ } -+ if (oi == mi.length) { -+ sg_miter_next(&mi); -+ oi = 0; -+ } -+ -+ spaces = readl(ss->base + SS_FCSR); -+ rx_cnt = SS_RXFIFO_SPACES(spaces); -+ tx_cnt = SS_TXFIFO_SPACES(spaces); -+ -+ todo = min3(tx_cnt, oleft, (mo.length - oo) / 4); -+ if (todo > 0) { -+ oleft -= todo; -+ readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); -+ oo += todo * 4; -+ } -+ if (oo == mo.length) { -+ sg_miter_next(&mo); -+ oo = 0; -+ } -+ } while (mo.length > 0); -+ -+release_ss: -+ sg_miter_stop(&mi); -+ sg_miter_stop(&mo); -+ writel(0, ss->base + SS_CTL); -+ spin_unlock_bh(&ss->slock); -+ return err; -+} -+ -+/* Generic function that support SG with size not multiple of 4 */ -+static int sun4i_ss_cipher_poll(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_ss_ctx *ss = op->ss; -+ int no_chunk = 1; -+ struct scatterlist *in_sg = areq->src; -+ struct scatterlist *out_sg = areq->dst; -+ unsigned int ivsize = crypto_ablkcipher_ivsize(tfm); -+ struct sun4i_cipher_req_ctx *ctx = ablkcipher_request_ctx(areq); -+ u32 mode = ctx->mode; -+ /* when activating SS, the default FIFO space is 32 */ -+ u32 rx_cnt = 32; -+ u32 tx_cnt = 0; -+ u32 v; -+ u32 spaces; -+ int i, err = 0; -+ unsigned int ileft = areq->nbytes; -+ unsigned int oleft = areq->nbytes; -+ unsigned int todo; -+ struct sg_mapping_iter mi, mo; -+ unsigned int oi, oo; /* offset for in and out */ -+ char buf[4 * 32];/* buffer for linearize SG src */ -+ char bufo[4 * 32];/* buffer for linearize SG dst */ -+ unsigned int ob = 0; /* offset in buf */ -+ unsigned int obo = 0; /* offset in bufo*/ -+ unsigned int obl = 0; /* length of data in bufo */ -+ -+ if (areq->nbytes == 0) -+ return 0; -+ -+ if (areq->info == NULL) { -+ dev_err(ss->dev, "ERROR: Empty IV\n"); -+ return -EINVAL; -+ } -+ -+ if (areq->src == NULL || areq->dst == NULL) { -+ dev_err(ss->dev, "ERROR: Some SGs are NULL\n"); -+ return -EINVAL; -+ } -+ -+ /* -+ * if we have only SGs with size multiple of 4, -+ * we can use the SS optimized function -+ */ -+ while (in_sg != NULL && no_chunk == 1) { -+ if ((in_sg->length % 4) != 0) -+ no_chunk = 0; -+ in_sg = sg_next(in_sg); -+ } -+ while (out_sg != NULL && no_chunk == 1) { -+ if ((out_sg->length % 4) != 0) -+ no_chunk = 0; -+ out_sg = sg_next(out_sg); -+ } -+ -+ if (no_chunk == 1) -+ return sun4i_ss_opti_poll(areq); -+ -+ spin_lock_bh(&ss->slock); -+ -+ for (i = 0; i < op->keylen; i += 4) -+ writel(*(op->key + i / 4), ss->base + SS_KEY0 + i); -+ -+ if (areq->info != NULL) { -+ for (i = 0; i < 4 && i < ivsize / 4; i++) { -+ v = *(u32 *)(areq->info + i * 4); -+ writel(v, ss->base + SS_IV0 + i * 4); -+ } -+ } -+ writel(mode, ss->base + SS_CTL); -+ -+ sg_miter_start(&mi, areq->src, sg_nents(areq->src), -+ SG_MITER_FROM_SG | SG_MITER_ATOMIC); -+ sg_miter_start(&mo, areq->dst, sg_nents(areq->dst), -+ SG_MITER_TO_SG | SG_MITER_ATOMIC); -+ sg_miter_next(&mi); -+ sg_miter_next(&mo); -+ if (mi.addr == NULL || mo.addr == NULL) { -+ dev_err(ss->dev, "ERROR: sg_miter return null\n"); -+ err = -EINVAL; -+ goto release_ss; -+ } -+ ileft = areq->nbytes; -+ oleft = areq->nbytes; -+ oi = 0; -+ oo = 0; -+ -+ while (oleft > 0) { -+ if (ileft > 0) { -+ /* -+ * todo is the number of consecutive 4byte word that we -+ * can read from current SG -+ */ -+ todo = min3(rx_cnt, ileft / 4, (mi.length - oi) / 4); -+ if (todo > 0 && ob == 0) { -+ writesl(ss->base + SS_RXFIFO, mi.addr + oi, -+ todo); -+ ileft -= todo * 4; -+ oi += todo * 4; -+ } else { -+ /* -+ * not enought consecutive bytes, so we need to -+ * linearize in buf. todo is in bytes -+ * After that copy, if we have a multiple of 4 -+ * we need to be able to write all buf in one -+ * pass, so it is why we min() with rx_cnt -+ */ -+ todo = min3(rx_cnt * 4 - ob, ileft, -+ mi.length - oi); -+ memcpy(buf + ob, mi.addr + oi, todo); -+ ileft -= todo; -+ oi += todo; -+ ob += todo; -+ if (ob % 4 == 0) { -+ writesl(ss->base + SS_RXFIFO, buf, -+ ob / 4); -+ ob = 0; -+ } -+ } -+ if (oi == mi.length) { -+ sg_miter_next(&mi); -+ oi = 0; -+ } -+ } -+ -+ spaces = readl(ss->base + SS_FCSR); -+ rx_cnt = SS_RXFIFO_SPACES(spaces); -+ tx_cnt = SS_TXFIFO_SPACES(spaces); -+ dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u %u\n", -+ mode, -+ oi, mi.length, ileft, areq->nbytes, rx_cnt, -+ oo, mo.length, oleft, areq->nbytes, tx_cnt, -+ todo, ob); -+ -+ if (tx_cnt == 0) -+ continue; -+ /* todo in 4bytes word */ -+ todo = min3(tx_cnt, oleft / 4, (mo.length - oo) / 4); -+ if (todo > 0) { -+ readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); -+ oleft -= todo * 4; -+ oo += todo * 4; -+ if (oo == mo.length) { -+ sg_miter_next(&mo); -+ oo = 0; -+ } -+ } else { -+ /* -+ * read obl bytes in bufo, we read at maximum for -+ * empying the device -+ */ -+ readsl(ss->base + SS_TXFIFO, bufo, tx_cnt); -+ obl = tx_cnt * 4; -+ obo = 0; -+ do { -+ /* -+ * how many bytes we can copy ? -+ * no more than remaining SG size -+ * no more than remaining buffer -+ * no need to test against oleft -+ */ -+ todo = min(mo.length - oo, obl - obo); -+ memcpy(mo.addr + oo, bufo + obo, todo); -+ oleft -= todo; -+ obo += todo; -+ oo += todo; -+ if (oo == mo.length) { -+ sg_miter_next(&mo); -+ oo = 0; -+ } -+ } while (obo < obl); -+ /* bufo must be fully used here */ -+ } -+ } -+ -+release_ss: -+ sg_miter_stop(&mi); -+ sg_miter_stop(&mo); -+ writel(0, ss->base + SS_CTL); -+ spin_unlock_bh(&ss->slock); -+ -+ return err; -+} -+ -+/* CBC AES */ -+int sun4i_ss_cbc_aes_encrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_AES | SS_CBC | SS_ENABLED | SS_ENCRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_cbc_aes_decrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_AES | SS_CBC | SS_ENABLED | SS_DECRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+/* ECB AES */ -+int sun4i_ss_ecb_aes_encrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_AES | SS_ECB | SS_ENABLED | SS_ENCRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_ecb_aes_decrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_AES | SS_ECB | SS_ENABLED | SS_DECRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+/* CBC DES */ -+int sun4i_ss_cbc_des_encrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_DES | SS_CBC | SS_ENABLED | SS_ENCRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_cbc_des_decrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_DES | SS_CBC | SS_ENABLED | SS_DECRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+/* ECB DES */ -+int sun4i_ss_ecb_des_encrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_DES | SS_ECB | SS_ENABLED | SS_ENCRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_ecb_des_decrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_DES | SS_ECB | SS_ENABLED | SS_DECRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+/* CBC 3DES */ -+int sun4i_ss_cbc_des3_encrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_3DES | SS_CBC | SS_ENABLED | SS_ENCRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_cbc_des3_decrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_3DES | SS_CBC | SS_ENABLED | SS_DECRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+/* ECB 3DES */ -+int sun4i_ss_ecb_des3_encrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_3DES | SS_ECB | SS_ENABLED | SS_ENCRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_ecb_des3_decrypt(struct ablkcipher_request *areq) -+{ -+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(areq); -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_cipher_req_ctx *rctx = ablkcipher_request_ctx(areq); -+ -+ rctx->mode = SS_OP_3DES | SS_ECB | SS_ENABLED | SS_DECRYPTION | -+ op->keymode; -+ return sun4i_ss_cipher_poll(areq); -+} -+ -+int sun4i_ss_cipher_init(struct crypto_tfm *tfm) -+{ -+ struct sun4i_tfm_ctx *op = crypto_tfm_ctx(tfm); -+ struct crypto_alg *alg = tfm->__crt_alg; -+ struct sun4i_ss_alg_template *algt; -+ -+ memset(op, 0, sizeof(struct sun4i_tfm_ctx)); -+ -+ algt = container_of(alg, struct sun4i_ss_alg_template, alg.crypto); -+ op->ss = algt->ss; -+ -+ tfm->crt_ablkcipher.reqsize = sizeof(struct sun4i_cipher_req_ctx); -+ -+ return 0; -+} -+ -+/* check and set the AES key, prepare the mode to be used */ -+int sun4i_ss_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key, -+ unsigned int keylen) -+{ -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_ss_ctx *ss = op->ss; -+ -+ switch (keylen) { -+ case 128 / 8: -+ op->keymode = SS_AES_128BITS; -+ break; -+ case 192 / 8: -+ op->keymode = SS_AES_192BITS; -+ break; -+ case 256 / 8: -+ op->keymode = SS_AES_256BITS; -+ break; -+ default: -+ dev_err(ss->dev, "ERROR: Invalid keylen %u\n", keylen); -+ crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); -+ return -EINVAL; -+ } -+ op->keylen = keylen; -+ memcpy(op->key, key, keylen); -+ return 0; -+} -+ -+/* check and set the DES key, prepare the mode to be used */ -+int sun4i_ss_des_setkey(struct crypto_ablkcipher *tfm, const u8 *key, -+ unsigned int keylen) -+{ -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_ss_ctx *ss = op->ss; -+ u32 flags; -+ u32 tmp[DES_EXPKEY_WORDS]; -+ int ret; -+ -+ if (unlikely(keylen != DES_KEY_SIZE)) { -+ dev_err(ss->dev, "Invalid keylen %u\n", keylen); -+ crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); -+ return -EINVAL; -+ } -+ -+ flags = crypto_ablkcipher_get_flags(tfm); -+ -+ ret = des_ekey(tmp, key); -+ if (unlikely(ret == 0) && (flags & CRYPTO_TFM_REQ_WEAK_KEY)) { -+ crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_WEAK_KEY); -+ dev_dbg(ss->dev, "Weak key %u\n", keylen); -+ return -EINVAL; -+ } -+ -+ op->keylen = keylen; -+ memcpy(op->key, key, keylen); -+ return 0; -+} -+ -+/* check and set the 3DES key, prepare the mode to be used */ -+int sun4i_ss_des3_setkey(struct crypto_ablkcipher *tfm, const u8 *key, -+ unsigned int keylen) -+{ -+ struct sun4i_tfm_ctx *op = crypto_ablkcipher_ctx(tfm); -+ struct sun4i_ss_ctx *ss = op->ss; -+ -+ if (unlikely(keylen != 3 * DES_KEY_SIZE)) { -+ dev_err(ss->dev, "Invalid keylen %u\n", keylen); -+ crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); -+ return -EINVAL; -+ } -+ op->keylen = keylen; -+ memcpy(op->key, key, keylen); -+ return 0; -+} -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c b/drivers/crypto/sunxi-ss/sun4i-ss-core.c -new file mode 100644 -index 0000000..fcb4c01 ---- /dev/null -+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c -@@ -0,0 +1,395 @@ -+/* -+ * sun4i-ss-core.c - hardware cryptographic accelerator for Allwinner A20 SoC -+ * -+ * Copyright (C) 2013-2015 Corentin LABBE -+ * -+ * Core file which registers crypto algorithms supported by the SS. -+ * -+ * You could find a link for the datasheet in Documentation/arm/sunxi/README -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "sun4i-ss.h" -+ -+static struct sun4i_ss_alg_template driver_algs[] = { -+{ .type = CRYPTO_ALG_TYPE_AHASH, -+ .alg.hash = { -+ .init = sun4i_hash_init, -+ .update = sun4i_hash_update, -+ .final = sun4i_hash_final, -+ .finup = sun4i_hash_finup, -+ .digest = sun4i_hash_digest, -+ .export = sun4i_hash_export_md5, -+ .import = sun4i_hash_import_md5, -+ .halg = { -+ .digestsize = MD5_DIGEST_SIZE, -+ .base = { -+ .cra_name = "md5", -+ .cra_driver_name = "md5-sun4i-ss", -+ .cra_priority = 300, -+ .cra_alignmask = 3, -+ .cra_flags = CRYPTO_ALG_TYPE_AHASH, -+ .cra_blocksize = MD5_HMAC_BLOCK_SIZE, -+ .cra_ctxsize = sizeof(struct sun4i_req_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_type = &crypto_ahash_type, -+ .cra_init = sun4i_hash_crainit -+ } -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_AHASH, -+ .alg.hash = { -+ .init = sun4i_hash_init, -+ .update = sun4i_hash_update, -+ .final = sun4i_hash_final, -+ .finup = sun4i_hash_finup, -+ .digest = sun4i_hash_digest, -+ .export = sun4i_hash_export_sha1, -+ .import = sun4i_hash_import_sha1, -+ .halg = { -+ .digestsize = SHA1_DIGEST_SIZE, -+ .base = { -+ .cra_name = "sha1", -+ .cra_driver_name = "sha1-sun4i-ss", -+ .cra_priority = 300, -+ .cra_alignmask = 3, -+ .cra_flags = CRYPTO_ALG_TYPE_AHASH, -+ .cra_blocksize = SHA1_BLOCK_SIZE, -+ .cra_ctxsize = sizeof(struct sun4i_req_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_type = &crypto_ahash_type, -+ .cra_init = sun4i_hash_crainit -+ } -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .alg.crypto = { -+ .cra_name = "cbc(aes)", -+ .cra_driver_name = "cbc-aes-sun4i-ss", -+ .cra_priority = 300, -+ .cra_blocksize = AES_BLOCK_SIZE, -+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .cra_ctxsize = sizeof(struct sun4i_tfm_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_alignmask = 3, -+ .cra_type = &crypto_ablkcipher_type, -+ .cra_init = sun4i_ss_cipher_init, -+ .cra_ablkcipher = { -+ .min_keysize = AES_MIN_KEY_SIZE, -+ .max_keysize = AES_MAX_KEY_SIZE, -+ .ivsize = AES_BLOCK_SIZE, -+ .setkey = sun4i_ss_aes_setkey, -+ .encrypt = sun4i_ss_cbc_aes_encrypt, -+ .decrypt = sun4i_ss_cbc_aes_decrypt, -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .alg.crypto = { -+ .cra_name = "ecb(aes)", -+ .cra_driver_name = "ecb-aes-sun4i-ss", -+ .cra_priority = 300, -+ .cra_blocksize = AES_BLOCK_SIZE, -+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .cra_ctxsize = sizeof(struct sun4i_tfm_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_alignmask = 3, -+ .cra_type = &crypto_ablkcipher_type, -+ .cra_init = sun4i_ss_cipher_init, -+ .cra_ablkcipher = { -+ .min_keysize = AES_MIN_KEY_SIZE, -+ .max_keysize = AES_MAX_KEY_SIZE, -+ .ivsize = AES_BLOCK_SIZE, -+ .setkey = sun4i_ss_aes_setkey, -+ .encrypt = sun4i_ss_ecb_aes_encrypt, -+ .decrypt = sun4i_ss_ecb_aes_decrypt, -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .alg.crypto = { -+ .cra_name = "cbc(des)", -+ .cra_driver_name = "cbc-des-sun4i-ss", -+ .cra_priority = 300, -+ .cra_blocksize = DES_BLOCK_SIZE, -+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .cra_ctxsize = sizeof(struct sun4i_req_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_alignmask = 3, -+ .cra_type = &crypto_ablkcipher_type, -+ .cra_init = sun4i_ss_cipher_init, -+ .cra_u.ablkcipher = { -+ .min_keysize = DES_KEY_SIZE, -+ .max_keysize = DES_KEY_SIZE, -+ .ivsize = DES_BLOCK_SIZE, -+ .setkey = sun4i_ss_des_setkey, -+ .encrypt = sun4i_ss_cbc_des_encrypt, -+ .decrypt = sun4i_ss_cbc_des_decrypt, -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .alg.crypto = { -+ .cra_name = "ecb(des)", -+ .cra_driver_name = "ecb-des-sun4i-ss", -+ .cra_priority = 300, -+ .cra_blocksize = DES_BLOCK_SIZE, -+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .cra_ctxsize = sizeof(struct sun4i_req_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_alignmask = 3, -+ .cra_type = &crypto_ablkcipher_type, -+ .cra_init = sun4i_ss_cipher_init, -+ .cra_u.ablkcipher = { -+ .min_keysize = DES_KEY_SIZE, -+ .max_keysize = DES_KEY_SIZE, -+ .setkey = sun4i_ss_des_setkey, -+ .encrypt = sun4i_ss_ecb_des_encrypt, -+ .decrypt = sun4i_ss_ecb_des_decrypt, -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .alg.crypto = { -+ .cra_name = "cbc(des3_ede)", -+ .cra_driver_name = "cbc-des3-sun4i-ss", -+ .cra_priority = 300, -+ .cra_blocksize = DES3_EDE_BLOCK_SIZE, -+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .cra_ctxsize = sizeof(struct sun4i_req_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_alignmask = 3, -+ .cra_type = &crypto_ablkcipher_type, -+ .cra_init = sun4i_ss_cipher_init, -+ .cra_u.ablkcipher = { -+ .min_keysize = DES3_EDE_KEY_SIZE, -+ .max_keysize = DES3_EDE_KEY_SIZE, -+ .ivsize = DES3_EDE_BLOCK_SIZE, -+ .setkey = sun4i_ss_des3_setkey, -+ .encrypt = sun4i_ss_cbc_des3_encrypt, -+ .decrypt = sun4i_ss_cbc_des3_decrypt, -+ } -+ } -+}, -+{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .alg.crypto = { -+ .cra_name = "ecb(des3_ede)", -+ .cra_driver_name = "ecb-des3-sun4i-ss", -+ .cra_priority = 300, -+ .cra_blocksize = DES3_EDE_BLOCK_SIZE, -+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER, -+ .cra_ctxsize = sizeof(struct sun4i_req_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_alignmask = 3, -+ .cra_type = &crypto_ablkcipher_type, -+ .cra_init = sun4i_ss_cipher_init, -+ .cra_u.ablkcipher = { -+ .min_keysize = DES3_EDE_KEY_SIZE, -+ .max_keysize = DES3_EDE_KEY_SIZE, -+ .ivsize = DES3_EDE_BLOCK_SIZE, -+ .setkey = sun4i_ss_des3_setkey, -+ .encrypt = sun4i_ss_ecb_des3_encrypt, -+ .decrypt = sun4i_ss_ecb_des3_decrypt, -+ } -+ } -+}, -+}; -+ -+static int sun4i_ss_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ u32 v; -+ int err, i; -+ unsigned long cr; -+ const unsigned long cr_ahb = 24 * 1000 * 1000; -+ const unsigned long cr_mod = 150 * 1000 * 1000; -+ struct sun4i_ss_ctx *ss; -+ -+ if (!pdev->dev.of_node) -+ return -ENODEV; -+ -+ ss = devm_kzalloc(&pdev->dev, sizeof(*ss), GFP_KERNEL); -+ if (ss == NULL) -+ return -ENOMEM; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ ss->base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(ss->base)) { -+ dev_err(&pdev->dev, "Cannot request MMIO\n"); -+ return PTR_ERR(ss->base); -+ } -+ -+ ss->ssclk = devm_clk_get(&pdev->dev, "mod"); -+ if (IS_ERR(ss->ssclk)) { -+ err = PTR_ERR(ss->ssclk); -+ dev_err(&pdev->dev, "Cannot get SS clock err=%d\n", err); -+ return err; -+ } -+ dev_dbg(&pdev->dev, "clock ss acquired\n"); -+ -+ ss->busclk = devm_clk_get(&pdev->dev, "ahb"); -+ if (IS_ERR(ss->busclk)) { -+ err = PTR_ERR(ss->busclk); -+ dev_err(&pdev->dev, "Cannot get AHB SS clock err=%d\n", err); -+ return err; -+ } -+ dev_dbg(&pdev->dev, "clock ahb_ss acquired\n"); -+ -+ /* Enable both clocks */ -+ err = clk_prepare_enable(ss->busclk); -+ if (err != 0) { -+ dev_err(&pdev->dev, "Cannot prepare_enable busclk\n"); -+ return err; -+ } -+ err = clk_prepare_enable(ss->ssclk); -+ if (err != 0) { -+ dev_err(&pdev->dev, "Cannot prepare_enable ssclk\n"); -+ goto error_ssclk; -+ } -+ -+ /* -+ * Check that clock have the correct rates gived in the datasheet -+ * Try to set the clock to the maximum allowed -+ */ -+ err = clk_set_rate(ss->ssclk, cr_mod); -+ if (err != 0) { -+ dev_err(&pdev->dev, "Cannot set clock rate to ssclk\n"); -+ goto error_clk; -+ } -+ -+ /* -+ * The only impact on clocks below requirement are bad performance, -+ * so do not print "errors" -+ * warn on Overclocked clocks -+ */ -+ cr = clk_get_rate(ss->busclk); -+ if (cr >= cr_ahb) -+ dev_dbg(&pdev->dev, "Clock bus %lu (%lu MHz) (must be >= %lu)\n", -+ cr, cr / 1000000, cr_ahb); -+ else -+ dev_warn(&pdev->dev, "Clock bus %lu (%lu MHz) (must be >= %lu)\n", -+ cr, cr / 1000000, cr_ahb); -+ -+ cr = clk_get_rate(ss->ssclk); -+ if (cr <= cr_mod) -+ if (cr < cr_mod) -+ dev_warn(&pdev->dev, "Clock ss %lu (%lu MHz) (must be <= %lu)\n", -+ cr, cr / 1000000, cr_mod); -+ else -+ dev_dbg(&pdev->dev, "Clock ss %lu (%lu MHz) (must be <= %lu)\n", -+ cr, cr / 1000000, cr_mod); -+ else -+ dev_warn(&pdev->dev, "Clock ss is at %lu (%lu MHz) (must be <= %lu)\n", -+ cr, cr / 1000000, cr_mod); -+ -+ /* -+ * Datasheet named it "Die Bonding ID" -+ * I expect to be a sort of Security System Revision number. -+ * Since the A80 seems to have an other version of SS -+ * this info could be useful -+ */ -+ writel(SS_ENABLED, ss->base + SS_CTL); -+ v = readl(ss->base + SS_CTL); -+ v >>= 16; -+ v &= 0x07; -+ dev_info(&pdev->dev, "Die ID %d\n", v); -+ writel(0, ss->base + SS_CTL); -+ -+ ss->dev = &pdev->dev; -+ -+ spin_lock_init(&ss->slock); -+ -+ for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { -+ driver_algs[i].ss = ss; -+ switch (driver_algs[i].type) { -+ case CRYPTO_ALG_TYPE_ABLKCIPHER: -+ err = crypto_register_alg(&driver_algs[i].alg.crypto); -+ if (err != 0) -+ goto error_alg; -+ break; -+ case CRYPTO_ALG_TYPE_AHASH: -+ err = crypto_register_ahash(&driver_algs[i].alg.hash); -+ if (err != 0) -+ goto error_alg; -+ break; -+ } -+ } -+ platform_set_drvdata(pdev, ss); -+ return 0; -+error_alg: -+ i--; -+ for (; i >= 0; i--) { -+ switch (driver_algs[i].type) { -+ case CRYPTO_ALG_TYPE_ABLKCIPHER: -+ crypto_unregister_alg(&driver_algs[i].alg.crypto); -+ break; -+ case CRYPTO_ALG_TYPE_AHASH: -+ crypto_unregister_ahash(&driver_algs[i].alg.hash); -+ break; -+ } -+ } -+error_clk: -+ clk_disable_unprepare(ss->ssclk); -+error_ssclk: -+ clk_disable_unprepare(ss->busclk); -+ return err; -+} -+ -+static int sun4i_ss_remove(struct platform_device *pdev) -+{ -+ int i; -+ struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev); -+ -+ for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { -+ switch (driver_algs[i].type) { -+ case CRYPTO_ALG_TYPE_ABLKCIPHER: -+ crypto_unregister_alg(&driver_algs[i].alg.crypto); -+ break; -+ case CRYPTO_ALG_TYPE_AHASH: -+ crypto_unregister_ahash(&driver_algs[i].alg.hash); -+ break; -+ } -+ } -+ -+ writel(0, ss->base + SS_CTL); -+ clk_disable_unprepare(ss->busclk); -+ clk_disable_unprepare(ss->ssclk); -+ return 0; -+} -+ -+static const struct of_device_id a20ss_crypto_of_match_table[] = { -+ { .compatible = "allwinner,sun4i-a10-crypto" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, a20ss_crypto_of_match_table); -+ -+static struct platform_driver sun4i_ss_driver = { -+ .probe = sun4i_ss_probe, -+ .remove = sun4i_ss_remove, -+ .driver = { -+ .name = "sun4i-ss", -+ .of_match_table = a20ss_crypto_of_match_table, -+ }, -+}; -+ -+module_platform_driver(sun4i_ss_driver); -+ -+MODULE_DESCRIPTION("Allwinner Security System cryptographic accelerator"); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Corentin LABBE "); -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c -new file mode 100644 -index 0000000..fcd2157 ---- /dev/null -+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c -@@ -0,0 +1,501 @@ -+/* -+ * sun4i-ss-hash.c - hardware cryptographic accelerator for Allwinner A20 SoC -+ * -+ * Copyright (C) 2013-2015 Corentin LABBE -+ * -+ * This file add support for MD5 and SHA1. -+ * -+ * You could find the datasheet in Documentation/arm/sunxi/README -+ * -+ * 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 "sun4i-ss.h" -+#include -+ -+/* This is a totaly arbitrary value */ -+#define SS_TIMEOUT 100 -+ -+int sun4i_hash_crainit(struct crypto_tfm *tfm) -+{ -+ crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm), -+ sizeof(struct sun4i_req_ctx)); -+ return 0; -+} -+ -+/* sun4i_hash_init: initialize request context */ -+int sun4i_hash_init(struct ahash_request *areq) -+{ -+ const char *hash_type; -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); -+ struct ahash_alg *alg = __crypto_ahash_alg(tfm->base.__crt_alg); -+ struct sun4i_ss_alg_template *algt; -+ struct sun4i_ss_ctx *ss; -+ -+ memset(op, 0, sizeof(struct sun4i_req_ctx)); -+ -+ algt = container_of(alg, struct sun4i_ss_alg_template, alg.hash); -+ ss = algt->ss; -+ op->ss = algt->ss; -+ -+ hash_type = crypto_tfm_alg_name(areq->base.tfm); -+ -+ if (strcmp(hash_type, "sha1") == 0) -+ op->mode = SS_OP_SHA1; -+ else if (strcmp(hash_type, "md5") == 0) -+ op->mode = SS_OP_MD5; -+ else -+ return -EINVAL; -+ -+ return 0; -+} -+ -+int sun4i_hash_export_md5(struct ahash_request *areq, void *out) -+{ -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ struct md5_state *octx = out; -+ int i; -+ -+ octx->byte_count = op->byte_count + op->len; -+ -+ memcpy(octx->block, op->buf, op->len); -+ -+ if (op->byte_count > 0) { -+ for (i = 0; i < 4; i++) -+ octx->hash[i] = op->hash[i]; -+ } else { -+ octx->hash[0] = SHA1_H0; -+ octx->hash[1] = SHA1_H1; -+ octx->hash[2] = SHA1_H2; -+ octx->hash[3] = SHA1_H3; -+ } -+ -+ return 0; -+} -+ -+int sun4i_hash_import_md5(struct ahash_request *areq, const void *in) -+{ -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ const struct md5_state *ictx = in; -+ int i; -+ -+ op->byte_count = ictx->byte_count & ~0x3F; -+ op->len = ictx->byte_count & 0x3F; -+ -+ memcpy(op->buf, ictx->block, op->len); -+ -+ for (i = 0; i < 4; i++) -+ op->hash[i] = ictx->hash[i]; -+ -+ return 0; -+} -+ -+int sun4i_hash_export_sha1(struct ahash_request *areq, void *out) -+{ -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ struct sha1_state *octx = out; -+ int i; -+ -+ octx->count = op->byte_count + op->len; -+ -+ memcpy(octx->buffer, op->buf, op->len); -+ -+ if (op->byte_count > 0) { -+ for (i = 0; i < 5; i++) -+ octx->state[i] = op->hash[i]; -+ } else { -+ octx->state[0] = SHA1_H0; -+ octx->state[1] = SHA1_H1; -+ octx->state[2] = SHA1_H2; -+ octx->state[3] = SHA1_H3; -+ octx->state[4] = SHA1_H4; -+ } -+ -+ return 0; -+} -+ -+int sun4i_hash_import_sha1(struct ahash_request *areq, const void *in) -+{ -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ const struct sha1_state *ictx = in; -+ int i; -+ -+ op->byte_count = ictx->count & ~0x3F; -+ op->len = ictx->count & 0x3F; -+ -+ memcpy(op->buf, ictx->buffer, op->len); -+ -+ for (i = 0; i < 5; i++) -+ op->hash[i] = ictx->state[i]; -+ -+ return 0; -+} -+ -+/* -+ * sun4i_hash_update: update hash engine -+ * -+ * Could be used for both SHA1 and MD5 -+ * Write data by step of 32bits and put then in the SS. -+ * -+ * Since we cannot leave partial data and hash state in the engine, -+ * we need to get the hash state at the end of this function. -+ * We can get the hash state every 64 bytes -+ * -+ * So the first work is to get the number of bytes to write to SS modulo 64 -+ * The extra bytes will go to a temporary buffer op->buf storing op->len bytes -+ * -+ * So at the begin of update() -+ * if op->len + areq->nbytes < 64 -+ * => all data will be writen to wait buffer (op->buf) and end=0 -+ * if not, write all data from op->buf to the device and position end to -+ * complete to 64bytes -+ * -+ * example 1: -+ * update1 60o => op->len=60 -+ * update2 60o => need one more word to have 64 bytes -+ * end=4 -+ * so write all data from op->buf and one word of SGs -+ * write remaining data in op->buf -+ * final state op->len=56 -+ */ -+int sun4i_hash_update(struct ahash_request *areq) -+{ -+ u32 v, ivmode = 0; -+ unsigned int i = 0; -+ /* -+ * i is the total bytes read from SGs, to be compared to areq->nbytes -+ * i is important because we cannot rely on SG length since the sum of -+ * SG->length could be greater than areq->nbytes -+ */ -+ -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ struct sun4i_ss_ctx *ss = op->ss; -+ unsigned int in_i = 0; /* advancement in the current SG */ -+ unsigned int end; -+ /* -+ * end is the position when we need to stop writing to the device, -+ * to be compared to i -+ */ -+ int in_r, err = 0; -+ unsigned int todo; -+ u32 spaces, rx_cnt = 32; -+ size_t copied = 0; -+ struct sg_mapping_iter mi; -+ -+ dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x", -+ __func__, crypto_tfm_alg_name(areq->base.tfm), -+ op->byte_count, areq->nbytes, op->mode, -+ op->len, op->hash[0]); -+ -+ if (areq->nbytes == 0) -+ return 0; -+ -+ /* protect againt overflow */ -+ if (areq->nbytes > UINT_MAX - op->len) { -+ dev_err(ss->dev, "Cannot process too large request\n"); -+ return -EINVAL; -+ } -+ -+ if (op->len + areq->nbytes < 64) { -+ /* linearize data to op->buf */ -+ copied = sg_pcopy_to_buffer(areq->src, sg_nents(areq->src), -+ op->buf + op->len, areq->nbytes, 0); -+ op->len += copied; -+ return 0; -+ } -+ -+ end = ((areq->nbytes + op->len) / 64) * 64 - op->len; -+ -+ if (end > areq->nbytes || areq->nbytes - end > 63) { -+ dev_err(ss->dev, "ERROR: Bound error %u %u\n", -+ end, areq->nbytes); -+ return -EINVAL; -+ } -+ -+ spin_lock_bh(&ss->slock); -+ -+ /* -+ * if some data have been processed before, -+ * we need to restore the partial hash state -+ */ -+ if (op->byte_count > 0) { -+ ivmode = SS_IV_ARBITRARY; -+ for (i = 0; i < 5; i++) -+ writel(op->hash[i], ss->base + SS_IV0 + i * 4); -+ } -+ /* Enable the device */ -+ writel(op->mode | SS_ENABLED | ivmode, ss->base + SS_CTL); -+ -+ rx_cnt = 32; -+ i = 0; -+ sg_miter_start(&mi, areq->src, sg_nents(areq->src), -+ SG_MITER_FROM_SG | SG_MITER_ATOMIC); -+ sg_miter_next(&mi); -+ in_i = 0; -+ -+ do { -+ /* -+ * we need to linearize in two case: -+ * - the buffer is already used -+ * - the SG does not have enought byte remaining ( < 4) -+ */ -+ if (op->len > 0 || (mi.length - in_i) < 4) { -+ /* -+ * if we have entered here we have two reason to stop -+ * - the buffer is full -+ * - reach the end -+ */ -+ while (op->len < 64 && i < end) { -+ /* how many bytes we can read from current SG */ -+ in_r = min3(mi.length - in_i, end - i, -+ 64 - op->len); -+ memcpy(op->buf + op->len, mi.addr + in_i, in_r); -+ op->len += in_r; -+ i += in_r; -+ in_i += in_r; -+ if (in_i == mi.length) { -+ sg_miter_next(&mi); -+ in_i = 0; -+ } -+ } -+ if (op->len > 3 && (op->len % 4) == 0) { -+ /* write buf to the device */ -+ writesl(ss->base + SS_RXFIFO, op->buf, -+ op->len / 4); -+ op->byte_count += op->len; -+ op->len = 0; -+ } -+ } -+ if (mi.length - in_i > 3 && i < end) { -+ /* how many bytes we can read from current SG */ -+ in_r = min3(mi.length - in_i, areq->nbytes - i, -+ ((mi.length - in_i) / 4) * 4); -+ /* how many bytes we can write in the device*/ -+ todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); -+ writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); -+ op->byte_count += todo * 4; -+ i += todo * 4; -+ in_i += todo * 4; -+ rx_cnt -= todo; -+ if (rx_cnt == 0) { -+ spaces = readl(ss->base + SS_FCSR); -+ rx_cnt = SS_RXFIFO_SPACES(spaces); -+ } -+ if (in_i == mi.length) { -+ sg_miter_next(&mi); -+ in_i = 0; -+ } -+ } -+ } while (i < end); -+ /* final linear */ -+ if ((areq->nbytes - i) < 64) { -+ while (i < areq->nbytes && in_i < mi.length && op->len < 64) { -+ /* how many bytes we can read from current SG */ -+ in_r = min3(mi.length - in_i, areq->nbytes - i, -+ 64 - op->len); -+ memcpy(op->buf + op->len, mi.addr + in_i, in_r); -+ op->len += in_r; -+ i += in_r; -+ in_i += in_r; -+ if (in_i == mi.length) { -+ sg_miter_next(&mi); -+ in_i = 0; -+ } -+ } -+ } -+ -+ sg_miter_stop(&mi); -+ -+ writel(op->mode | SS_ENABLED | SS_DATA_END, ss->base + SS_CTL); -+ i = 0; -+ do { -+ v = readl(ss->base + SS_CTL); -+ i++; -+ } while (i < SS_TIMEOUT && (v & SS_DATA_END) > 0); -+ if (i >= SS_TIMEOUT) { -+ dev_err(ss->dev, "ERROR: hash end timeout %d>%d ctl=%x len=%u\n", -+ i, SS_TIMEOUT, v, areq->nbytes); -+ err = -EIO; -+ goto release_ss; -+ } -+ -+ /* get the partial hash only if something was written */ -+ if (op->mode == SS_OP_SHA1) { -+ for (i = 0; i < 5; i++) -+ op->hash[i] = readl(ss->base + SS_MD0 + i * 4); -+ } else { -+ for (i = 0; i < 4; i++) -+ op->hash[i] = readl(ss->base + SS_MD0 + i * 4); -+ } -+ -+release_ss: -+ writel(0, ss->base + SS_CTL); -+ spin_unlock_bh(&ss->slock); -+ return err; -+} -+ -+/* -+ * sun4i_hash_final: finalize hashing operation -+ * -+ * If we have some remaining bytes, we write them. -+ * Then ask the SS for finalizing the hashing operation -+ * -+ * I do not check RX FIFO size in this function since the size is 32 -+ * after each enabling and this function neither write more than 32 words. -+ */ -+int sun4i_hash_final(struct ahash_request *areq) -+{ -+ u32 v, ivmode = 0; -+ unsigned int i; -+ unsigned int j = 0; -+ int zeros, err = 0; -+ unsigned int index, padlen; -+ __be64 bits; -+ struct sun4i_req_ctx *op = ahash_request_ctx(areq); -+ struct sun4i_ss_ctx *ss = op->ss; -+ u32 bf[32]; -+ u32 wb = 0; -+ unsigned int nwait, nbw = 0; -+ -+ dev_dbg(ss->dev, "%s: byte=%llu len=%u mode=%x wl=%u h=%x", -+ __func__, op->byte_count, areq->nbytes, op->mode, -+ op->len, op->hash[0]); -+ -+ spin_lock_bh(&ss->slock); -+ -+ /* -+ * if we have already writed something, -+ * restore the partial hash state -+ */ -+ if (op->byte_count > 0) { -+ ivmode = SS_IV_ARBITRARY; -+ for (i = 0; i < 5; i++) -+ writel(op->hash[i], ss->base + SS_IV0 + i * 4); -+ } -+ writel(op->mode | SS_ENABLED | ivmode, ss->base + SS_CTL); -+ -+ /* write the remaining words of the wait buffer */ -+ if (op->len > 0) { -+ nwait = op->len / 4; -+ if (nwait > 0) { -+ writesl(ss->base + SS_RXFIFO, op->buf, nwait); -+ op->byte_count += 4 * nwait; -+ } -+ nbw = op->len - 4 * nwait; -+ wb = *(u32 *)(op->buf + nwait * 4); -+ wb &= (0xFFFFFFFF >> (4 - nbw) * 8); -+ } -+ -+ /* write the remaining bytes of the nbw buffer */ -+ if (nbw > 0) { -+ wb |= ((1 << 7) << (nbw * 8)); -+ bf[j++] = wb; -+ } else { -+ bf[j++] = 1 << 7; -+ } -+ -+ /* -+ * number of space to pad to obtain 64o minus 8(size) minus 4 (final 1) -+ * I take the operations from other md5/sha1 implementations -+ */ -+ -+ /* we have already send 4 more byte of which nbw data */ -+ if (op->mode == SS_OP_MD5) { -+ index = (op->byte_count + 4) & 0x3f; -+ op->byte_count += nbw; -+ if (index > 56) -+ zeros = (120 - index) / 4; -+ else -+ zeros = (56 - index) / 4; -+ } else { -+ op->byte_count += nbw; -+ index = op->byte_count & 0x3f; -+ padlen = (index < 56) ? (56 - index) : ((64 + 56) - index); -+ zeros = (padlen - 1) / 4; -+ } -+ -+ /*for (i = 0; i < zeros; i++) -+ bf[j++] = 0;*/ -+ memset(bf + j, 0, 4 * zeros); -+ j += zeros; -+ -+ /* write the length of data */ -+ if (op->mode == SS_OP_SHA1) { -+ bits = cpu_to_be64(op->byte_count << 3); -+ bf[j++] = bits & 0xffffffff; -+ bf[j++] = (bits >> 32) & 0xffffffff; -+ } else { -+ bf[j++] = (op->byte_count << 3) & 0xffffffff; -+ bf[j++] = (op->byte_count >> 29) & 0xffffffff; -+ } -+ writesl(ss->base + SS_RXFIFO, bf, j); -+ -+ /* Tell the SS to stop the hashing */ -+ writel(op->mode | SS_ENABLED | SS_DATA_END, ss->base + SS_CTL); -+ -+ /* -+ * Wait for SS to finish the hash. -+ * The timeout could happend only in case of bad overcloking -+ * or driver bug. -+ */ -+ i = 0; -+ do { -+ v = readl(ss->base + SS_CTL); -+ i++; -+ } while (i < SS_TIMEOUT && (v & SS_DATA_END) > 0); -+ if (i >= SS_TIMEOUT) { -+ dev_err(ss->dev, "ERROR: hash end timeout %d>%d ctl=%x len=%u\n", -+ i, SS_TIMEOUT, v, areq->nbytes); -+ err = -EIO; -+ goto release_ss; -+ } -+ -+ /* Get the hash from the device */ -+ if (op->mode == SS_OP_SHA1) { -+ for (i = 0; i < 5; i++) { -+ v = cpu_to_be32(readl(ss->base + SS_MD0 + i * 4)); -+ memcpy(areq->result + i * 4, &v, 4); -+ } -+ } else { -+ for (i = 0; i < 4; i++) { -+ v = readl(ss->base + SS_MD0 + i * 4); -+ memcpy(areq->result + i * 4, &v, 4); -+ } -+ } -+ -+release_ss: -+ writel(0, ss->base + SS_CTL); -+ spin_unlock_bh(&ss->slock); -+ return err; -+} -+ -+/* sun4i_hash_finup: finalize hashing operation after an update */ -+int sun4i_hash_finup(struct ahash_request *areq) -+{ -+ int err; -+ -+ err = sun4i_hash_update(areq); -+ if (err != 0) -+ return err; -+ -+ return sun4i_hash_final(areq); -+} -+ -+/* combo of init/update/final functions */ -+int sun4i_hash_digest(struct ahash_request *areq) -+{ -+ int err; -+ -+ err = sun4i_hash_init(areq); -+ if (err != 0) -+ return err; -+ -+ err = sun4i_hash_update(areq); -+ if (err != 0) -+ return err; -+ -+ return sun4i_hash_final(areq); -+} -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss.h b/drivers/crypto/sunxi-ss/sun4i-ss.h -new file mode 100644 -index 0000000..6bb0ba8 ---- /dev/null -+++ b/drivers/crypto/sunxi-ss/sun4i-ss.h -@@ -0,0 +1,195 @@ -+/* -+ * sun4i-ss.h - hardware cryptographic accelerator for Allwinner A20 SoC -+ * -+ * Copyright (C) 2013-2015 Corentin LABBE -+ * -+ * Support AES cipher with 128,192,256 bits keysize. -+ * Support MD5 and SHA1 hash algorithms. -+ * Support DES and 3DES -+ * -+ * You could find the datasheet in Documentation/arm/sunxi/README -+ * -+ * Licensed under the GPL-2. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define SS_CTL 0x00 -+#define SS_KEY0 0x04 -+#define SS_KEY1 0x08 -+#define SS_KEY2 0x0C -+#define SS_KEY3 0x10 -+#define SS_KEY4 0x14 -+#define SS_KEY5 0x18 -+#define SS_KEY6 0x1C -+#define SS_KEY7 0x20 -+ -+#define SS_IV0 0x24 -+#define SS_IV1 0x28 -+#define SS_IV2 0x2C -+#define SS_IV3 0x30 -+ -+#define SS_FCSR 0x44 -+ -+#define SS_MD0 0x4C -+#define SS_MD1 0x50 -+#define SS_MD2 0x54 -+#define SS_MD3 0x58 -+#define SS_MD4 0x5C -+ -+#define SS_RXFIFO 0x200 -+#define SS_TXFIFO 0x204 -+ -+/* SS_CTL configuration values */ -+ -+/* PRNG generator mode - bit 15 */ -+#define SS_PRNG_ONESHOT (0 << 15) -+#define SS_PRNG_CONTINUE (1 << 15) -+ -+/* IV mode for hash */ -+#define SS_IV_ARBITRARY (1 << 14) -+ -+/* SS operation mode - bits 12-13 */ -+#define SS_ECB (0 << 12) -+#define SS_CBC (1 << 12) -+#define SS_CTS (3 << 12) -+ -+/* Counter width for CNT mode - bits 10-11 */ -+#define SS_CNT_16BITS (0 << 10) -+#define SS_CNT_32BITS (1 << 10) -+#define SS_CNT_64BITS (2 << 10) -+ -+/* Key size for AES - bits 8-9 */ -+#define SS_AES_128BITS (0 << 8) -+#define SS_AES_192BITS (1 << 8) -+#define SS_AES_256BITS (2 << 8) -+ -+/* Operation direction - bit 7 */ -+#define SS_ENCRYPTION (0 << 7) -+#define SS_DECRYPTION (1 << 7) -+ -+/* SS Method - bits 4-6 */ -+#define SS_OP_AES (0 << 4) -+#define SS_OP_DES (1 << 4) -+#define SS_OP_3DES (2 << 4) -+#define SS_OP_SHA1 (3 << 4) -+#define SS_OP_MD5 (4 << 4) -+#define SS_OP_PRNG (5 << 4) -+ -+/* Data end bit - bit 2 */ -+#define SS_DATA_END (1 << 2) -+ -+/* PRNG start bit - bit 1 */ -+#define SS_PRNG_START (1 << 1) -+ -+/* SS Enable bit - bit 0 */ -+#define SS_DISABLED (0 << 0) -+#define SS_ENABLED (1 << 0) -+ -+/* SS_FCSR configuration values */ -+/* RX FIFO status - bit 30 */ -+#define SS_RXFIFO_FREE (1 << 30) -+ -+/* RX FIFO empty spaces - bits 24-29 */ -+#define SS_RXFIFO_SPACES(val) (((val) >> 24) & 0x3f) -+ -+/* TX FIFO status - bit 22 */ -+#define SS_TXFIFO_AVAILABLE (1 << 22) -+ -+/* TX FIFO available spaces - bits 16-21 */ -+#define SS_TXFIFO_SPACES(val) (((val) >> 16) & 0x3f) -+ -+#define SS_RXFIFO_EMP_INT_PENDING (1 << 10) -+#define SS_TXFIFO_AVA_INT_PENDING (1 << 8) -+#define SS_RXFIFO_EMP_INT_ENABLE (1 << 2) -+#define SS_TXFIFO_AVA_INT_ENABLE (1 << 0) -+ -+ -+struct sun4i_ss_ctx { -+ void __iomem *base; -+ int irq; -+ struct clk *busclk; -+ struct clk *ssclk; -+ struct device *dev; -+ struct resource *res; -+ spinlock_t slock; /* control the use of the device */ -+}; -+ -+struct sun4i_ss_alg_template { -+ u32 type; -+ union { -+ struct crypto_alg crypto; -+ struct ahash_alg hash; -+ } alg; -+ struct sun4i_ss_ctx *ss; -+}; -+ -+struct sun4i_tfm_ctx { -+ u32 key[AES_MAX_KEY_SIZE / 4];/* divided by sizeof(u32) */ -+ u32 keylen; -+ u32 keymode; -+ struct sun4i_ss_ctx *ss; -+}; -+ -+struct sun4i_cipher_req_ctx { -+ u32 mode; -+}; -+ -+struct sun4i_req_ctx { -+ u32 mode; -+ u64 byte_count; /* number of bytes "uploaded" to the device */ -+ u32 hash[5]; /* for storing SS_IVx register */ -+ char buf[64]; -+ unsigned int len; -+ struct sun4i_ss_ctx *ss; -+}; -+ -+int sun4i_hash_crainit(struct crypto_tfm *tfm); -+int sun4i_hash_init(struct ahash_request *areq); -+int sun4i_hash_update(struct ahash_request *areq); -+int sun4i_hash_final(struct ahash_request *areq); -+int sun4i_hash_finup(struct ahash_request *areq); -+int sun4i_hash_digest(struct ahash_request *areq); -+int sun4i_hash_export_md5(struct ahash_request *areq, void *out); -+int sun4i_hash_import_md5(struct ahash_request *areq, const void *in); -+int sun4i_hash_export_sha1(struct ahash_request *areq, void *out); -+int sun4i_hash_import_sha1(struct ahash_request *areq, const void *in); -+ -+int sun4i_ss_cbc_aes_encrypt(struct ablkcipher_request *areq); -+int sun4i_ss_cbc_aes_decrypt(struct ablkcipher_request *areq); -+int sun4i_ss_ecb_aes_encrypt(struct ablkcipher_request *areq); -+int sun4i_ss_ecb_aes_decrypt(struct ablkcipher_request *areq); -+ -+int sun4i_ss_cbc_des_encrypt(struct ablkcipher_request *areq); -+int sun4i_ss_cbc_des_decrypt(struct ablkcipher_request *areq); -+int sun4i_ss_ecb_des_encrypt(struct ablkcipher_request *areq); -+int sun4i_ss_ecb_des_decrypt(struct ablkcipher_request *areq); -+ -+int sun4i_ss_cbc_des3_encrypt(struct ablkcipher_request *areq); -+int sun4i_ss_cbc_des3_decrypt(struct ablkcipher_request *areq); -+int sun4i_ss_ecb_des3_encrypt(struct ablkcipher_request *areq); -+int sun4i_ss_ecb_des3_decrypt(struct ablkcipher_request *areq); -+ -+int sun4i_ss_cipher_init(struct crypto_tfm *tfm); -+int sun4i_ss_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key, -+ unsigned int keylen); -+int sun4i_ss_des_setkey(struct crypto_ablkcipher *tfm, const u8 *key, -+ unsigned int keylen); -+int sun4i_ss_des3_setkey(struct crypto_ablkcipher *tfm, const u8 *key, -+ unsigned int keylen); --- -2.3.6 - diff --git a/patch/kernel/0007-MAINTAINERS-Add-myself-as-maintainer-of-Allwinner-Se.patch b/patch/kernel/0007-MAINTAINERS-Add-myself-as-maintainer-of-Allwinner-Se.patch deleted file mode 100644 index 4c3dfec70..000000000 --- a/patch/kernel/0007-MAINTAINERS-Add-myself-as-maintainer-of-Allwinner-Se.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 086a380119420becff42d04f01e71b84332221c6 Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Sun, 19 Oct 2014 14:50:22 +0200 -Subject: [PATCH 7/8] MAINTAINERS: Add myself as maintainer of Allwinner - Security System - -Signed-off-by: LABBE Corentin ---- - MAINTAINERS | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/MAINTAINERS b/MAINTAINERS -index 474bcb6..754b569 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -555,6 +555,12 @@ S: Maintained - F: Documentation/i2c/busses/i2c-ali1563 - F: drivers/i2c/busses/i2c-ali1563.c - -+ALLWINNER SECURITY SYSTEM -+M: Corentin Labbe -+L: linux-crypto@vger.kernel.org -+S: Maintained -+F: drivers/crypto/sunxi-ss/ -+ - ALPHA PORT - M: Richard Henderson - M: Ivan Kokshaysky --- -2.3.6 - diff --git a/patch/kernel/0008-crypto-sun4i-ss-support-the-Security-System-PRNG.patch b/patch/kernel/0008-crypto-sun4i-ss-support-the-Security-System-PRNG.patch deleted file mode 100644 index 3d11a3666..000000000 --- a/patch/kernel/0008-crypto-sun4i-ss-support-the-Security-System-PRNG.patch +++ /dev/null @@ -1,183 +0,0 @@ -From faf8cb104cdae9dd88303fd2788128f8460bd4ca Mon Sep 17 00:00:00 2001 -From: LABBE Corentin -Date: Fri, 27 Mar 2015 10:05:19 +0100 -Subject: [PATCH 8/8] crypto: sun4i-ss: support the Security System PRNG - -The Security System have a PRNG. -This patch add support for it as an hwrng. - -Signed-off-by: LABBE Corentin ---- - drivers/crypto/Kconfig | 1 + - drivers/crypto/sunxi-ss/Makefile | 2 +- - drivers/crypto/sunxi-ss/sun4i-ss-core.c | 5 +++ - drivers/crypto/sunxi-ss/sun4i-ss-hwrng.c | 77 ++++++++++++++++++++++++++++++++ - drivers/crypto/sunxi-ss/sun4i-ss.h | 7 +++ - 5 files changed, 91 insertions(+), 1 deletion(-) - create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss-hwrng.c - -diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig -index 2a5598e..979bc2a 100644 ---- a/drivers/crypto/Kconfig -+++ b/drivers/crypto/Kconfig -@@ -467,6 +467,7 @@ config CRYPTO_DEV_SUN4I_SS - select CRYPTO_AES - select CRYPTO_DES - select CRYPTO_BLKCIPHER -+ select HW_RANDOM - help - Some Allwinner SoC have a crypto accelerator named - Security System. Select this if you want to use it. -diff --git a/drivers/crypto/sunxi-ss/Makefile b/drivers/crypto/sunxi-ss/Makefile -index 8f4c7a2..e846fe8 100644 ---- a/drivers/crypto/sunxi-ss/Makefile -+++ b/drivers/crypto/sunxi-ss/Makefile -@@ -1,2 +1,2 @@ - obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss.o --sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o -+sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o sun4i-ss-hwrng.o -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c b/drivers/crypto/sunxi-ss/sun4i-ss-core.c -index fcb4c01..f3a410a 100644 ---- a/drivers/crypto/sunxi-ss/sun4i-ss-core.c -+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c -@@ -331,6 +331,9 @@ static int sun4i_ss_probe(struct platform_device *pdev) - } - } - platform_set_drvdata(pdev, ss); -+ -+ sun4i_ss_hwrng_register(&ss->hwrng); -+ - return 0; - error_alg: - i--; -@@ -356,6 +359,8 @@ static int sun4i_ss_remove(struct platform_device *pdev) - int i; - struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev); - -+ sun4i_ss_hwrng_remove(&ss->hwrng); -+ - for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { - switch (driver_algs[i].type) { - case CRYPTO_ALG_TYPE_ABLKCIPHER: -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hwrng.c b/drivers/crypto/sunxi-ss/sun4i-ss-hwrng.c -new file mode 100644 -index 0000000..0af67a8a1 ---- /dev/null -+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hwrng.c -@@ -0,0 +1,77 @@ -+#include "sun4i-ss.h" -+ -+static int sun4i_ss_hwrng_init(struct hwrng *hwrng) -+{ -+ struct sun4i_ss_ctx *ss; -+ -+ ss = container_of(hwrng, struct sun4i_ss_ctx, hwrng); -+ get_random_bytes(ss->seed, SS_SEED_LEN); -+ -+ return 0; -+} -+ -+static int sun4i_ss_hwrng_read(struct hwrng *hwrng, void *buf, -+ size_t max, bool wait) -+{ -+ int i; -+ u32 v; -+ u32 *data = buf; -+ u32 mode = SS_OP_PRNG | SS_PRNG_ONESHOT | SS_ENABLED; -+ size_t len; -+ struct sun4i_ss_ctx *ss; -+ -+ ss = container_of(hwrng, struct sun4i_ss_ctx, hwrng); -+ len = min_t(size_t, SS_DATA_LEN, max); -+ -+ spin_lock_bh(&ss->slock); -+ -+ writel(mode, ss->base + SS_CTL); -+ for (i = 0; i < SS_SEED_LEN / 4; i++) -+ writel(ss->seed[i], ss->base + SS_KEY0 + i * 4); -+ writel(mode | SS_PRNG_START, ss->base + SS_CTL); -+ -+#define SS_HWRNG_TIMEOUT 30 -+ /* if we are in SS_PRNG_ONESHOT mode, wait for completion */ -+ if ((mode & SS_PRNG_CONTINUE) == 0) { -+ i = 0; -+ do { -+ v = readl(ss->base + SS_CTL); -+ i++; -+ } while (v != mode && i < SS_HWRNG_TIMEOUT); -+ if (v != mode) { -+ dev_err(ss->dev, -+ "ERROR: hwrng end timeout %d>%d ctl=%x\n", -+ i, SS_HWRNG_TIMEOUT, v); -+ len = -EFAULT; -+ goto release_ss; -+ } -+ } -+ -+ for (i = 0; i < len; i += 4) { -+ v = readl(ss->base + SS_MD0 + i); -+ *(data + i / 4) = v; -+ } -+ for (i = 0; i < SS_SEED_LEN / 4; i++) { -+ v = readl(ss->base + SS_KEY0 + i * 4); -+ ss->seed[i] = v; -+ } -+release_ss: -+ writel(0, ss->base + SS_CTL); -+ spin_unlock_bh(&ss->slock); -+ return len; -+} -+ -+int sun4i_ss_hwrng_register(struct hwrng *hwrng) -+{ -+ hwrng->name = "sunxi Security System"; -+ hwrng->init = sun4i_ss_hwrng_init; -+ hwrng->read = sun4i_ss_hwrng_read; -+ -+ /*sun4i_ss_hwrng_init(hwrng);*/ -+ return hwrng_register(hwrng); -+} -+ -+void sun4i_ss_hwrng_remove(struct hwrng *hwrng) -+{ -+ hwrng_unregister(hwrng); -+} -diff --git a/drivers/crypto/sunxi-ss/sun4i-ss.h b/drivers/crypto/sunxi-ss/sun4i-ss.h -index 6bb0ba8..2185a05 100644 ---- a/drivers/crypto/sunxi-ss/sun4i-ss.h -+++ b/drivers/crypto/sunxi-ss/sun4i-ss.h -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -120,6 +121,8 @@ - #define SS_RXFIFO_EMP_INT_ENABLE (1 << 2) - #define SS_TXFIFO_AVA_INT_ENABLE (1 << 0) - -+#define SS_SEED_LEN (160/8) -+#define SS_DATA_LEN (160 / 8) - - struct sun4i_ss_ctx { - void __iomem *base; -@@ -129,6 +132,8 @@ struct sun4i_ss_ctx { - struct device *dev; - struct resource *res; - spinlock_t slock; /* control the use of the device */ -+ struct hwrng hwrng; -+ u32 seed[SS_SEED_LEN / 4]; - }; - - struct sun4i_ss_alg_template { -@@ -193,3 +198,5 @@ int sun4i_ss_des_setkey(struct crypto_ablkcipher *tfm, const u8 *key, - unsigned int keylen); - int sun4i_ss_des3_setkey(struct crypto_ablkcipher *tfm, const u8 *key, - unsigned int keylen); -+int sun4i_ss_hwrng_register(struct hwrng *hwrng); -+void sun4i_ss_hwrng_remove(struct hwrng *hwrng); --- -2.3.6 - diff --git a/patch/kernel/0009-a31_breaks.patch b/patch/kernel/0009-a31_breaks.patch deleted file mode 100644 index 9798ea7f5..000000000 --- a/patch/kernel/0009-a31_breaks.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -541,12 +541,12 @@ - sun5i-a13-hsg-h702.dtb \ - sun5i-a13-olinuxino.dtb \ - sun5i-a13-olinuxino-micro.dtb --dtb-$(CONFIG_MACH_SUN6I) += \ -- sun6i-a31-app4-evb1.dtb \ -- sun6i-a31-colombus.dtb \ -- sun6i-a31-hummingbird.dtb \ -- sun6i-a31-m9.dtb \ -- sun6i-a31s-cs908.dtb -+#dtb-$(CONFIG_MACH_SUN6I) += \ -+# sun6i-a31-app4-evb1.dtb \ -+# sun6i-a31-colombus.dtb \ -+# sun6i-a31-hummingbird.dtb \ -+# sun6i-a31-m9.dtb \ -+# sun6i-a31s-cs908.dtb - dtb-$(CONFIG_MACH_SUN7I) += \ - sun7i-a20-bananapi.dtb \ - sun7i-a20-pcduino3-nano.dtb \ diff --git a/patch/kernel/allwinner-audio-4.x.patch b/patch/kernel/allwinner-audio-4.x.patch deleted file mode 100644 index d48738f94..000000000 --- a/patch/kernel/allwinner-audio-4.x.patch +++ /dev/null @@ -1,1929 +0,0 @@ - ARM: bcm2835: Add the DDC I2C controller to the device tree. - ARM: bcm2835: Switch to using the new clock driver support. - ARM: dts: sun6i: Add dts file for MSI Primo81 tablet - ARM: dts: sun6i: Add simplefb node labels to reference at board level - ARM: dts: sun4i: Enable audio codec on Marsboard A10. - ARM: dts: sun4i: Add dts file for the pov protab2-ips9 tablet - ARM: sun4i: Enable cubieboard audio codec - ARM: sun5i: chip: Enable the audio codec - ARM: sun4i: Enable audio-codec on Mele A1000 - ARM: sun7i: Enable cubieboard2 audio codec - ARM: sun7i: dt: enable audio codec on Cubietruck - ARM: sun7i: Add sunxi codec device node - ARM: sun5i: Add the Audio codec DT node - ARM: sun4i: Add sunxi codec device node - ARM: sun7i: Add audio codec clock - ARM: sun5i: Add audio codec clock - ARM: sun4i: Add audio codec clock - ARM: sun7i: Add audio PLL - ARM: sun5i: Add audio PLL - ARM: sun4i: Add audio PLL - ... -Diffstat --rw-r--r-- Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt 45 --rw-r--r-- arch/arm/boot/dts/Makefile 9 --rw-r--r-- arch/arm/boot/dts/bcm2835-rpi-a-plus.dts 30 --rw-r--r-- arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts 23 --rw-r--r-- arch/arm/boot/dts/bcm2835-rpi-b.dts 8 --rw-r--r-- arch/arm/boot/dts/bcm2835-rpi.dtsi 4 --rw-r--r-- arch/arm/boot/dts/bcm2835.dtsi 64 --rw-r--r-- arch/arm/boot/dts/sun4i-a10-a1000.dts 4 --rw-r--r-- arch/arm/boot/dts/sun4i-a10-cubieboard.dts 4 --rw-r--r-- arch/arm/boot/dts/sun4i-a10-marsboard.dts 4 --rw-r--r-- arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts 199 --rw-r--r-- arch/arm/boot/dts/sun4i-a10.dtsi 31 --rw-r--r-- arch/arm/boot/dts/sun5i-r8-chip.dts 4 --rw-r--r-- arch/arm/boot/dts/sun5i.dtsi 31 --rw-r--r-- arch/arm/boot/dts/sun6i-a31.dtsi 4 --rw-r--r-- arch/arm/boot/dts/sun6i-a31s-primo81.dts 255 --rw-r--r-- arch/arm/boot/dts/sun6i-a31s-sina31s-core.dtsi 140 --rw-r--r-- arch/arm/boot/dts/sun6i-a31s-sina31s.dts 153 --rw-r--r-- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 4 --rw-r--r-- arch/arm/boot/dts/sun7i-a20-cubietruck.dts 4 --rw-r--r-- arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts 19 --rw-r--r-- arch/arm/boot/dts/sun7i-a20.dtsi 31 --rw-r--r-- drivers/clk/Makefile 2 --rw-r--r-- drivers/clk/bcm/Makefile 1 --rw-r--r-- drivers/clk/bcm/clk-bcm2835.c 1575 --rw-r--r-- drivers/clk/clk-bcm2835.c 55 --rw-r--r-- drivers/clk/clk-multiplier.c 181 --rw-r--r-- drivers/clk/sunxi/Makefile 3 --rw-r--r-- drivers/clk/sunxi/clk-a10-codec.c 44 --rw-r--r-- drivers/clk/sunxi/clk-a10-mod1.c 81 --rw-r--r-- drivers/clk/sunxi/clk-a10-pll2.c 216 --rw-r--r-- drivers/clk/sunxi/clk-simple-gates.c 2 --rw-r--r-- include/dt-bindings/clock/bcm2835.h 47 --rw-r--r-- include/dt-bindings/clock/sun4i-a10-pll2.h 53 --rw-r--r-- include/linux/clk-provider.h 42 -diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts -index 2630d78..97570cb 100644 ---- a/arch/arm/boot/dts/sun4i-a10-a1000.dts -+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts -@@ -93,6 +93,10 @@ - status = "okay"; - }; - -+&codec { -+ status = "okay"; -+}; -+ - &ehci0 { - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts -index 046a84d..710e2ef 100644 ---- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts -+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts -@@ -83,6 +83,10 @@ - status = "okay"; - }; - -+&codec { -+ status = "okay"; -+}; -+ - &cpu0 { - cpu-supply = <®_dcdc2>; - }; -diff --git a/arch/arm/boot/dts/sun4i-a10-marsboard.dts b/arch/arm/boot/dts/sun4i-a10-marsboard.dts -index 9a012db..8e50723 100644 ---- a/arch/arm/boot/dts/sun4i-a10-marsboard.dts -+++ b/arch/arm/boot/dts/sun4i-a10-marsboard.dts -@@ -91,6 +91,10 @@ - status = "okay"; - }; - -+&codec { -+ status = "okay"; -+}; -+ - &ehci0 { - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts b/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts -new file mode 100644 -index 0000000..82e69c3 ---- /dev/null -+++ b/arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts -@@ -0,0 +1,199 @@ -+/* -+ * Copyright 2015 Hans de Goede -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+#include "sun4i-a10.dtsi" -+#include "sunxi-common-regulators.dtsi" -+#include -+#include -+#include -+#include -+ -+/ { -+ model = "Point of View Protab2-IPS9"; -+ compatible = "pov,protab2-ips9", "allwinner,sun4i-a10"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+}; -+ -+&cpu0 { -+ cpu-supply = <®_dcdc2>; -+}; -+ -+&ehci0 { -+ status = "okay"; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins_a>; -+ status = "okay"; -+ -+ axp209: pmic@34 { -+ reg = <0x34>; -+ interrupts = <0>; -+ }; -+}; -+ -+#include "axp209.dtsi" -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins_a>; -+ /* pull-ups and devices require AXP209 LDO3 */ -+ status = "failed"; -+}; -+ -+&i2c2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c2_pins_a>; -+ status = "okay"; -+}; -+ -+&lradc { -+ vref-supply = <®_ldo2>; -+ status = "okay"; -+ -+ button@400 { -+ label = "Volume Up"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <400000>; -+ }; -+ -+ button@800 { -+ label = "Volume Down"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <800000>; -+ }; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&otg_sram { -+ status = "okay"; -+}; -+ -+&pio { -+ usb0_id_detect_pin: usb0_id_detect_pin@0 { -+ allwinner,pins = "PH4"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 { -+ allwinner,pins = "PH5"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+}; -+ -+®_dcdc2 { -+ regulator-always-on; -+ regulator-min-microvolt = <1000000>; -+ regulator-max-microvolt = <1400000>; -+ regulator-name = "vdd-cpu"; -+}; -+ -+®_dcdc3 { -+ regulator-always-on; -+ regulator-min-microvolt = <1250000>; -+ regulator-max-microvolt = <1250000>; -+ regulator-name = "vdd-int-dll"; -+}; -+ -+®_ldo1 { -+ regulator-name = "vdd-rtc"; -+}; -+ -+®_ldo2 { -+ regulator-always-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-name = "avcc"; -+}; -+ -+®_usb0_vbus { -+ status = "okay"; -+}; -+ -+®_usb1_vbus { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; -+ -+&usb_otg { -+ dr_mode = "otg"; -+ status = "okay"; -+}; -+ -+&usbphy { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>; -+ usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ -+ usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */ -+ usb0_vbus-supply = <®_usb0_vbus>; -+ usb1_vbus-supply = <®_usb1_vbus>; -+ status = "okay"; -+}; -diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi -index 1f3c51a..aa90f31 100644 ---- a/arch/arm/boot/dts/sun4i-a10.dtsi -+++ b/arch/arm/boot/dts/sun4i-a10.dtsi -@@ -45,6 +45,7 @@ - - #include - -+#include - #include - #include - -@@ -195,6 +196,15 @@ - clock-output-names = "pll1"; - }; - -+ pll2: clk@01c20008 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-pll2-clk"; -+ reg = <0x01c20008 0x8>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll2-1x", "pll2-2x", -+ "pll2-4x", "pll2-8x"; -+ }; -+ - pll4: clk@01c20018 { - #clock-cells = <0>; - compatible = "allwinner,sun4i-a10-pll1-clk"; -@@ -481,6 +491,14 @@ - clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; - clock-output-names = "spi3"; - }; -+ -+ codec_clk: clk@01c20140 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-codec-clk"; -+ reg = <0x01c20140 0x4>; -+ clocks = <&pll2 SUN4I_A10_PLL2_1X>; -+ clock-output-names = "codec"; -+ }; - }; - - soc@01c00000 { -@@ -1004,6 +1022,19 @@ - status = "disabled"; - }; - -+ codec: codec@01c22c00 { -+ #sound-dai-cells = <0>; -+ compatible = "allwinner,sun4i-a10-codec"; -+ reg = <0x01c22c00 0x40>; -+ interrupts = <30>; -+ clocks = <&apb0_gates 0>, <&codec_clk>; -+ clock-names = "apb", "codec"; -+ dmas = <&dma SUN4I_DMA_NORMAL 19>, -+ <&dma SUN4I_DMA_NORMAL 19>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ - sid: eeprom@01c23800 { - compatible = "allwinner,sun4i-a10-sid"; - reg = <0x01c23800 0x10>; -diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi -index 9ffee9b..59a9426 100644 ---- a/arch/arm/boot/dts/sun5i.dtsi -+++ b/arch/arm/boot/dts/sun5i.dtsi -@@ -44,6 +44,7 @@ - - #include "skeleton.dtsi" - -+#include - #include - #include - -@@ -102,6 +103,15 @@ - clock-output-names = "pll1"; - }; - -+ pll2: clk@01c20008 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun5i-a13-pll2-clk"; -+ reg = <0x01c20008 0x8>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll2-1x", "pll2-2x", -+ "pll2-4x", "pll2-8x"; -+ }; -+ - pll4: clk@01c20018 { - #clock-cells = <0>; - compatible = "allwinner,sun4i-a10-pll1-clk"; -@@ -285,6 +295,14 @@ - clock-output-names = "usb_ohci0", "usb_phy"; - }; - -+ codec_clk: clk@01c20140 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-codec-clk"; -+ reg = <0x01c20140 0x4>; -+ clocks = <&pll2 SUN4I_A10_PLL2_1X>; -+ clock-output-names = "codec"; -+ }; -+ - mbus_clk: clk@01c2015c { - #clock-cells = <0>; - compatible = "allwinner,sun5i-a13-mbus-clk"; -@@ -571,6 +589,19 @@ - status = "disabled"; - }; - -+ codec: codec@01c22c00 { -+ #sound-dai-cells = <0>; -+ compatible = "allwinner,sun4i-a10-codec"; -+ reg = <0x01c22c00 0x40>; -+ interrupts = <30>; -+ clocks = <&apb0_gates 0>, <&codec_clk>; -+ clock-names = "apb", "codec"; -+ dmas = <&dma SUN4I_DMA_NORMAL 19>, -+ <&dma SUN4I_DMA_NORMAL 19>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ - sid: eeprom@01c23800 { - compatible = "allwinner,sun4i-a10-sid"; - reg = <0x01c23800 0x10>; -diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi -index 83c1879..b6ad785 100644 ---- a/arch/arm/boot/dts/sun6i-a31.dtsi -+++ b/arch/arm/boot/dts/sun6i-a31.dtsi -@@ -61,7 +61,7 @@ - #size-cells = <1>; - ranges; - -- framebuffer@0 { -+ simplefb_hdmi: framebuffer@0 { - compatible = "allwinner,simple-framebuffer", - "simple-framebuffer"; - allwinner,pipeline = "de_be0-lcd0-hdmi"; -@@ -69,7 +69,7 @@ - status = "disabled"; - }; - -- framebuffer@1 { -+ simplefb_lcd: framebuffer@1 { - compatible = "allwinner,simple-framebuffer", - "simple-framebuffer"; - allwinner,pipeline = "de_be0-lcd0"; -diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts -new file mode 100644 -index 0000000..2d4250b ---- /dev/null -+++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts -@@ -0,0 +1,255 @@ -+/* -+ * Copyright 2014 Siarhei Siamashka -+ * Copyright 2015 Karsten Merker -+ * Copyright 2015 Chen-Yu Tsai -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+#include "sun6i-a31s.dtsi" -+#include "sunxi-common-regulators.dtsi" -+ -+#include -+#include -+#include -+ -+/ { -+ model = "MSI Primo81 tablet"; -+ compatible = "msi,primo81", "allwinner,sun6i-a31s"; -+}; -+ -+&cpu0 { -+ cpu-supply = <®_dcdc3>; -+}; -+ -+&ehci0 { -+ /* rtl8188etv wifi is connected here */ -+ status = "okay"; -+}; -+ -+&i2c0 { -+ /* pull-ups and device VDDIO use AXP221 DLDO3 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins_a>; -+ status = "failed"; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins_a>; -+ status = "okay"; -+ -+ ctp@5d { -+ pinctrl-names = "default"; -+ pinctrl-0 = <>911_int_primo81>; -+ compatible = "goodix,gt911"; -+ reg = <0x5d>; -+ interrupt-parent = <&pio>; -+ interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; /* PA3 */ -+ }; -+}; -+ -+&i2c2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c2_pins_a>; -+ status = "okay"; -+ -+ accelerometer@1c { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mma8452_int_primo81>; -+ compatible = "fsl,mma8452"; -+ reg = <0x1c>; -+ interrupt-parent = <&pio>; -+ interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>; /* PA9 */ -+ #io-channel-cells = <1>; -+ }; -+}; -+ -+&lradc { -+ vref-supply = <®_aldo3>; -+ status = "okay"; -+ -+ button@158 { -+ label = "Volume Up"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <158730>; -+ }; -+ -+ button@349 { -+ label = "Volume Down"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <349206>; -+ }; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_primo81>; -+ vmmc-supply = <®_dcdc1>; -+ bus-width = <4>; -+ cd-gpios = <&pio 0 8 GPIO_ACTIVE_HIGH>; /* PA8 */ -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&pio { -+ gt911_int_primo81: gt911_int_pin@0 { -+ allwinner,pins = "PA3"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mma8452_int_primo81: mma8452_int_pin@0 { -+ allwinner,pins = "PA9"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc0_cd_pin_primo81: mmc0_cd_pin@0 { -+ allwinner,pins = "PA8"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+}; -+ -+&p2wi { -+ status = "okay"; -+ -+ axp22x: pmic@68 { -+ compatible = "x-powers,axp221"; -+ reg = <0x68>; -+ interrupt-parent = <&nmi_intc>; -+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; -+ }; -+}; -+ -+#include "axp22x.dtsi" -+ -+®_aldo3 { -+ regulator-always-on; -+ regulator-min-microvolt = <2700000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "avcc"; -+}; -+ -+®_dc1sw { -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-name = "vcc-lcd"; -+}; -+ -+®_dc5ldo { -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-cpus"; /* This is an educated guess */ -+}; -+ -+®_dcdc1 { -+ regulator-always-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-name = "vcc-3v0"; -+}; -+ -+®_dcdc2 { -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-gpu"; -+}; -+ -+®_dcdc3 { -+ regulator-always-on; -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-cpu"; -+}; -+ -+®_dcdc4 { -+ regulator-always-on; -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-sys-dll"; -+}; -+ -+®_dcdc5 { -+ regulator-always-on; -+ regulator-min-microvolt = <1500000>; -+ regulator-max-microvolt = <1500000>; -+ regulator-name = "vcc-dram"; -+}; -+ -+®_dldo1 { -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "vcc-wifi"; -+}; -+ -+®_dldo3 { -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; -+ regulator-name = "vddio-csi"; -+}; -+ -+®_eldo3 { -+ regulator-min-microvolt = <1080000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-mipi-bridge"; -+}; -+ -+&simplefb_lcd { -+ vcc-lcd-supply = <®_dc1sw>; -+ vdd-mipi-bridge-supply = <®_eldo3>; -+}; -+ -+&usb_otg { -+ /* otg support requires support for AXP221 usb-power-supply and GPIO */ -+ dr_mode = "host"; -+ status = "okay"; -+}; -+ -+&usbphy { -+ usb1_vbus-supply = <®_dldo1>; -+ status = "okay"; -+}; -diff --git a/arch/arm/boot/dts/sun6i-a31s-sina31s-core.dtsi b/arch/arm/boot/dts/sun6i-a31s-sina31s-core.dtsi -new file mode 100644 -index 0000000..ea69fb8 ---- /dev/null -+++ b/arch/arm/boot/dts/sun6i-a31s-sina31s-core.dtsi -@@ -0,0 +1,140 @@ -+/* -+ * Copyright 2015 Chen-Yu Tsai -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+#include "sun6i-a31s.dtsi" -+#include "sunxi-common-regulators.dtsi" -+ -+#include -+#include -+ -+/ { -+ model = "Sinlinx SinA31s Core Board"; -+ compatible = "sinlinx,sina31s", "allwinner,sun6i-a31s"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+}; -+ -+&cpu0 { -+ cpu-supply = <®_dcdc3>; -+}; -+ -+/* eMMC on core board */ -+&mmc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc2_8bit_emmc_pins>; -+ vmmc-supply = <®_dcdc1>; -+ bus-width = <8>; -+ non-removable; -+ status = "okay"; -+}; -+ -+/* AXP221s PMIC on core board */ -+&p2wi { -+ status = "okay"; -+ -+ axp22x: pmic@68 { -+ compatible = "x-powers,axp221"; -+ reg = <0x68>; -+ interrupt-parent = <&nmi_intc>; -+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; -+ }; -+}; -+ -+#include "axp22x.dtsi" -+ -+®_aldo3 { -+ regulator-always-on; -+ regulator-min-microvolt = <2700000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "avcc"; -+}; -+ -+®_dc5ldo { -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-cpus"; -+}; -+ -+®_dcdc1 { -+ regulator-always-on; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-name = "vcc-3v0"; -+}; -+ -+®_dcdc2 { -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-gpu"; -+}; -+ -+®_dcdc3 { -+ regulator-always-on; -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-cpu"; -+}; -+ -+®_dcdc4 { -+ regulator-always-on; -+ regulator-min-microvolt = <700000>; -+ regulator-max-microvolt = <1320000>; -+ regulator-name = "vdd-sys-dll"; -+}; -+ -+®_dcdc5 { -+ regulator-always-on; -+ regulator-min-microvolt = <1500000>; -+ regulator-max-microvolt = <1500000>; -+ regulator-name = "vcc-dram"; -+}; -+ -+/* UART0 pads available on core board */ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; -+ -diff --git a/arch/arm/boot/dts/sun6i-a31s-sina31s.dts b/arch/arm/boot/dts/sun6i-a31s-sina31s.dts -new file mode 100644 -index 0000000..6ead2f5 ---- /dev/null -+++ b/arch/arm/boot/dts/sun6i-a31s-sina31s.dts -@@ -0,0 +1,153 @@ -+/* -+ * Copyright 2015 Chen-Yu Tsai -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* The SinA31s development board has the SinA31s core board soldered on */ -+#include "sun6i-a31s-sina31s-core.dtsi" -+ -+#include -+ -+/ { -+ model = "Sinlinx SinA31s Development Board"; -+ compatible = "sinlinx,sina31s-sdk", "allwinner,sun6i-a31s"; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&led_pin_sina31s>; -+ -+ status { -+ label = "sina31s:status:usr"; -+ gpios = <&pio 7 13 GPIO_ACTIVE_HIGH>; /* PH13 */ -+ }; -+ }; -+}; -+ -+&ehci0 { -+ /* USB 2.0 4 port hub IC */ -+ status = "okay"; -+}; -+ -+&ehci1 { -+ status = "okay"; -+}; -+ -+&gmac { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&gmac_pins_mii_a>; -+ phy = <&phy1>; -+ phy-mode = "mii"; -+ phy-supply = <®_dldo1>; -+ status = "okay"; -+ -+ phy1: ethernet-phy@1 { -+ reg = <1>; -+ }; -+}; -+ -+&ir { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&ir_pins_a>; -+ status = "okay"; -+}; -+ -+&lradc { -+ vref-supply = <®_aldo3>; -+ status = "okay"; -+ -+ button@158 { -+ label = "Volume Up"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <158730>; -+ }; -+ -+ button@349 { -+ label = "Volume Down"; -+ linux,code = ; -+ channel = <0>; -+ voltage = <349206>; -+ }; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_sina31s>; -+ vmmc-supply = <®_dcdc1>; -+ bus-width = <4>; -+ cd-gpios = <&pio 0 4 GPIO_ACTIVE_HIGH>; /* PA4 */ -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&ohci1 { -+ status = "okay"; -+}; -+ -+&pio { -+ led_pin_sina31s: led_pin@0 { -+ allwinner,pins = "PH13"; -+ allwinner,function = "gpio_out"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc0_cd_pin_sina31s: mmc0_cd_pin@0 { -+ allwinner,pins = "PA4"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+}; -+ -+®_dldo1 { -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "vcc-gmac-phy"; -+}; -+ -+&usbphy { -+ status = "okay"; -+}; -diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts -index 9ff459b..1fa832d 100644 ---- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts -+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts -@@ -84,6 +84,10 @@ - status = "okay"; - }; - -+&codec { -+ status = "okay"; -+}; -+ - &cpu0 { - cpu-supply = <®_dcdc2>; - }; -diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts -index e6b0192..8da939a 100644 ---- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts -+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts -@@ -101,6 +101,10 @@ - status = "okay"; - }; - -+&codec { -+ status = "okay"; -+}; -+ - &cpu0 { - cpu-supply = <®_dcdc2>; - }; -diff --git a/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts b/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts -index beac431..1757a6a 100644 ---- a/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts -+++ b/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts -@@ -142,6 +142,10 @@ - status = "okay"; - }; - -+&otg_sram { -+ status = "okay"; -+}; -+ - &pio { - ahci_pwr_pin_pcduino3_nano: ahci_pwr_pin@0 { - allwinner,pins = "PH2"; -@@ -157,6 +161,13 @@ - allwinner,pull = ; - }; - -+ usb0_id_detect_pin: usb0_id_detect_pin@0 { -+ allwinner,pins = "PH4"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ - usb1_vbus_pin_pcduino3_nano: usb1_vbus_pin@0 { - allwinner,pins = "PD2"; - allwinner,function = "gpio_out"; -@@ -211,7 +222,15 @@ - status = "okay"; - }; - -+&usb_otg { -+ dr_mode = "otg"; -+ status = "okay"; -+}; -+ - &usbphy { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb0_id_detect_pin>; -+ usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ - usb1_vbus-supply = <®_usb1_vbus>; - usb2_vbus-supply = <®_usb1_vbus>; - status = "okay"; -diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi -index 3a68852..e02eb72 100644 ---- a/arch/arm/boot/dts/sun7i-a20.dtsi -+++ b/arch/arm/boot/dts/sun7i-a20.dtsi -@@ -47,6 +47,7 @@ - #include - #include - -+#include - #include - #include - -@@ -199,6 +200,15 @@ - clock-output-names = "pll1"; - }; - -+ pll2: clk@01c20008 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-pll2-clk"; -+ reg = <0x01c20008 0x8>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll2-1x", "pll2-2x", -+ "pll2-4x", "pll2-8x"; -+ }; -+ - pll4: clk@01c20018 { - #clock-cells = <0>; - compatible = "allwinner,sun7i-a20-pll4-clk"; -@@ -491,6 +501,14 @@ - clock-output-names = "spi3"; - }; - -+ codec_clk: clk@01c20140 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-codec-clk"; -+ reg = <0x01c20140 0x4>; -+ clocks = <&pll2 SUN4I_A10_PLL2_1X>; -+ clock-output-names = "codec"; -+ }; -+ - mbus_clk: clk@01c2015c { - #clock-cells = <0>; - compatible = "allwinner,sun5i-a13-mbus-clk"; -@@ -1198,6 +1216,19 @@ - status = "disabled"; - }; - -+ codec: codec@01c22c00 { -+ #sound-dai-cells = <0>; -+ compatible = "allwinner,sun7i-a20-codec"; -+ reg = <0x01c22c00 0x40>; -+ interrupts = ; -+ clocks = <&apb0_gates 0>, <&codec_clk>; -+ clock-names = "apb", "codec"; -+ dmas = <&dma SUN4I_DMA_NORMAL 19>, -+ <&dma SUN4I_DMA_NORMAL 19>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ - sid: eeprom@01c23800 { - compatible = "allwinner,sun7i-a20-sid"; - reg = <0x01c23800 0x200>; -diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile -index a381431..1ec1ce1 100644 ---- a/drivers/clk/Makefile -+++ b/drivers/clk/Makefile -@@ -6,6 +6,7 @@ obj-$(CONFIG_COMMON_CLK) += clk-divider.o - obj-$(CONFIG_COMMON_CLK) += clk-fixed-factor.o - obj-$(CONFIG_COMMON_CLK) += clk-fixed-rate.o - obj-$(CONFIG_COMMON_CLK) += clk-gate.o -+obj-$(CONFIG_COMMON_CLK) += clk-multiplier.o - obj-$(CONFIG_COMMON_CLK) += clk-mux.o - obj-$(CONFIG_COMMON_CLK) += clk-composite.o - obj-$(CONFIG_COMMON_CLK) += clk-fractional-divider.o -@@ -19,7 +20,6 @@ endif - obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o - obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o - obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o --obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o - obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o - obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o - obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o -diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile -index 8a7a477..ee2349b 100644 ---- a/drivers/clk/bcm/Makefile -+++ b/drivers/clk/bcm/Makefile -@@ -3,4 +3,5 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o - obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o - obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o -+obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o - obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o -diff --git a/drivers/clk/clk-multiplier.c b/drivers/clk/clk-multiplier.c -new file mode 100644 -index 0000000..43ec269 ---- /dev/null -+++ b/drivers/clk/clk-multiplier.c -@@ -0,0 +1,181 @@ -+/* -+ * Copyright (C) 2015 Maxime Ripard -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define to_clk_multiplier(_hw) container_of(_hw, struct clk_multiplier, hw) -+ -+static unsigned long __get_mult(struct clk_multiplier *mult, -+ unsigned long rate, -+ unsigned long parent_rate) -+{ -+ if (mult->flags & CLK_MULTIPLIER_ROUND_CLOSEST) -+ return DIV_ROUND_CLOSEST(rate, parent_rate); -+ -+ return rate / parent_rate; -+} -+ -+static unsigned long clk_multiplier_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ struct clk_multiplier *mult = to_clk_multiplier(hw); -+ unsigned long val; -+ -+ val = clk_readl(mult->reg) >> mult->shift; -+ val &= GENMASK(mult->width - 1, 0); -+ -+ if (!val && mult->flags & CLK_MULTIPLIER_ZERO_BYPASS) -+ val = 1; -+ -+ return parent_rate * val; -+} -+ -+static bool __is_best_rate(unsigned long rate, unsigned long new, -+ unsigned long best, unsigned long flags) -+{ -+ if (flags & CLK_MULTIPLIER_ROUND_CLOSEST) -+ return abs(rate - new) < abs(rate - best); -+ -+ return new >= rate && new < best; -+} -+ -+static unsigned long __bestmult(struct clk_hw *hw, unsigned long rate, -+ unsigned long *best_parent_rate, -+ u8 width, unsigned long flags) -+{ -+ unsigned long orig_parent_rate = *best_parent_rate; -+ unsigned long parent_rate, current_rate, best_rate = ~0; -+ unsigned int i, bestmult = 0; -+ -+ if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) -+ return rate / *best_parent_rate; -+ -+ for (i = 1; i < ((1 << width) - 1); i++) { -+ if (rate == orig_parent_rate * i) { -+ /* -+ * This is the best case for us if we have a -+ * perfect match without changing the parent -+ * rate. -+ */ -+ *best_parent_rate = orig_parent_rate; -+ return i; -+ } -+ -+ parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), -+ rate / i); -+ current_rate = parent_rate * i; -+ -+ if (__is_best_rate(rate, current_rate, best_rate, flags)) { -+ bestmult = i; -+ best_rate = current_rate; -+ *best_parent_rate = parent_rate; -+ } -+ } -+ -+ return bestmult; -+} -+ -+static long clk_multiplier_round_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long *parent_rate) -+{ -+ struct clk_multiplier *mult = to_clk_multiplier(hw); -+ unsigned long factor = __bestmult(hw, rate, parent_rate, -+ mult->width, mult->flags); -+ -+ return *parent_rate * factor; -+} -+ -+static int clk_multiplier_set_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long parent_rate) -+{ -+ struct clk_multiplier *mult = to_clk_multiplier(hw); -+ unsigned long factor = __get_mult(mult, rate, parent_rate); -+ unsigned long flags = 0; -+ unsigned long val; -+ -+ if (mult->lock) -+ spin_lock_irqsave(mult->lock, flags); -+ else -+ __acquire(mult->lock); -+ -+ val = clk_readl(mult->reg); -+ val &= ~GENMASK(mult->width + mult->shift - 1, mult->shift); -+ val |= factor << mult->shift; -+ clk_writel(val, mult->reg); -+ -+ if (mult->lock) -+ spin_unlock_irqrestore(mult->lock, flags); -+ else -+ __release(mult->lock); -+ -+ return 0; -+} -+ -+const struct clk_ops clk_multiplier_ops = { -+ .recalc_rate = clk_multiplier_recalc_rate, -+ .round_rate = clk_multiplier_round_rate, -+ .set_rate = clk_multiplier_set_rate, -+}; -+EXPORT_SYMBOL_GPL(clk_multiplier_ops); -+ -+struct clk *clk_register_multiplier(struct device *dev, const char *name, -+ const char *parent_name, -+ unsigned long flags, -+ void __iomem *reg, u8 shift, u8 width, -+ u8 clk_mult_flags, spinlock_t *lock) -+{ -+ struct clk_init_data init; -+ struct clk_multiplier *mult; -+ struct clk *clk; -+ -+ mult = kmalloc(sizeof(*mult), GFP_KERNEL); -+ if (!mult) -+ return ERR_PTR(-ENOMEM); -+ -+ init.name = name; -+ init.ops = &clk_multiplier_ops; -+ init.flags = flags | CLK_IS_BASIC; -+ init.parent_names = &parent_name; -+ init.num_parents = 1; -+ -+ mult->reg = reg; -+ mult->shift = shift; -+ mult->width = width; -+ mult->flags = clk_mult_flags; -+ mult->lock = lock; -+ mult->hw.init = &init; -+ -+ clk = clk_register(dev, &mult->hw); -+ if (IS_ERR(clk)) -+ kfree(mult); -+ -+ return clk; -+} -+EXPORT_SYMBOL_GPL(clk_register_multiplier); -+ -+void clk_unregister_multiplier(struct clk *clk) -+{ -+ struct clk_multiplier *mult; -+ struct clk_hw *hw; -+ -+ hw = __clk_get_hw(clk); -+ if (!hw) -+ return; -+ -+ mult = to_clk_multiplier(hw); -+ -+ clk_unregister(clk); -+ kfree(mult); -+} -+EXPORT_SYMBOL_GPL(clk_unregister_multiplier); -diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile -index f5a35b8..cb4c299 100644 ---- a/drivers/clk/sunxi/Makefile -+++ b/drivers/clk/sunxi/Makefile -@@ -3,7 +3,10 @@ - # - - obj-y += clk-sunxi.o clk-factors.o -+obj-y += clk-a10-codec.o - obj-y += clk-a10-hosc.o -+obj-y += clk-a10-mod1.o -+obj-y += clk-a10-pll2.o - obj-y += clk-a20-gmac.o - obj-y += clk-mod0.o - obj-y += clk-simple-gates.o -diff --git a/drivers/clk/sunxi/clk-a10-codec.c b/drivers/clk/sunxi/clk-a10-codec.c -new file mode 100644 -index 0000000..ac321d6 ---- /dev/null -+++ b/drivers/clk/sunxi/clk-a10-codec.c -@@ -0,0 +1,44 @@ -+/* -+ * Copyright 2013 Emilio López -+ * -+ * Emilio López -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+ -+#define SUN4I_CODEC_GATE 31 -+ -+static void __init sun4i_codec_clk_setup(struct device_node *node) -+{ -+ struct clk *clk; -+ const char *clk_name = node->name, *parent_name; -+ void __iomem *reg; -+ -+ reg = of_io_request_and_map(node, 0, of_node_full_name(node)); -+ if (IS_ERR(reg)) -+ return; -+ -+ of_property_read_string(node, "clock-output-names", &clk_name); -+ parent_name = of_clk_get_parent_name(node, 0); -+ -+ clk = clk_register_gate(NULL, clk_name, parent_name, -+ CLK_SET_RATE_PARENT, reg, -+ SUN4I_CODEC_GATE, 0, NULL); -+ -+ if (!IS_ERR(clk)) -+ of_clk_add_provider(node, of_clk_src_simple_get, clk); -+} -+CLK_OF_DECLARE(sun4i_codec, "allwinner,sun4i-a10-codec-clk", -+ sun4i_codec_clk_setup); -diff --git a/drivers/clk/sunxi/clk-a10-mod1.c b/drivers/clk/sunxi/clk-a10-mod1.c -new file mode 100644 -index 0000000..e9d870d ---- /dev/null -+++ b/drivers/clk/sunxi/clk-a10-mod1.c -@@ -0,0 +1,81 @@ -+/* -+ * Copyright 2013 Emilio López -+ * -+ * Emilio López -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+static DEFINE_SPINLOCK(mod1_lock); -+ -+#define SUN4I_MOD1_ENABLE 31 -+#define SUN4I_MOD1_MUX 16 -+#define SUN4I_MOD1_MUX_WIDTH 2 -+#define SUN4I_MOD1_MAX_PARENTS 4 -+ -+static void __init sun4i_mod1_clk_setup(struct device_node *node) -+{ -+ struct clk *clk; -+ struct clk_mux *mux; -+ struct clk_gate *gate; -+ const char *parents[4]; -+ const char *clk_name = node->name; -+ void __iomem *reg; -+ int i; -+ -+ reg = of_io_request_and_map(node, 0, of_node_full_name(node)); -+ if (IS_ERR(reg)) -+ return; -+ -+ mux = kzalloc(sizeof(*mux), GFP_KERNEL); -+ if (!mux) -+ goto err_unmap; -+ -+ gate = kzalloc(sizeof(*gate), GFP_KERNEL); -+ if (!gate) -+ goto err_free_mux; -+ -+ of_property_read_string(node, "clock-output-names", &clk_name); -+ i = of_clk_parent_fill(node, parents, SUN4I_MOD1_MAX_PARENTS); -+ -+ gate->reg = reg; -+ gate->bit_idx = SUN4I_MOD1_ENABLE; -+ gate->lock = &mod1_lock; -+ mux->reg = reg; -+ mux->shift = SUN4I_MOD1_MUX; -+ mux->mask = BIT(SUN4I_MOD1_MUX_WIDTH) - 1; -+ mux->lock = &mod1_lock; -+ -+ clk = clk_register_composite(NULL, clk_name, parents, i, -+ &mux->hw, &clk_mux_ops, -+ NULL, NULL, -+ &gate->hw, &clk_gate_ops, 0); -+ if (IS_ERR(clk)) -+ goto err_free_gate; -+ -+ of_clk_add_provider(node, of_clk_src_simple_get, clk); -+ -+ return; -+ -+err_free_gate: -+ kfree(gate); -+err_free_mux: -+ kfree(mux); -+err_unmap: -+ iounmap(reg); -+} -+CLK_OF_DECLARE(sun4i_mod1, "allwinner,sun4i-a10-mod1-clk", -+ sun4i_mod1_clk_setup); -diff --git a/drivers/clk/sunxi/clk-a10-pll2.c b/drivers/clk/sunxi/clk-a10-pll2.c -new file mode 100644 -index 0000000..5484c31 ---- /dev/null -+++ b/drivers/clk/sunxi/clk-a10-pll2.c -@@ -0,0 +1,216 @@ -+/* -+ * Copyright 2013 Emilio López -+ * Emilio López -+ * -+ * Copyright 2015 Maxime Ripard -+ * Maxime Ripard -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define SUN4I_PLL2_ENABLE 31 -+ -+#define SUN4I_PLL2_PRE_DIV_SHIFT 0 -+#define SUN4I_PLL2_PRE_DIV_WIDTH 5 -+#define SUN4I_PLL2_PRE_DIV_MASK GENMASK(SUN4I_PLL2_PRE_DIV_WIDTH - 1, 0) -+ -+#define SUN4I_PLL2_N_SHIFT 8 -+#define SUN4I_PLL2_N_WIDTH 7 -+#define SUN4I_PLL2_N_MASK GENMASK(SUN4I_PLL2_N_WIDTH - 1, 0) -+ -+#define SUN4I_PLL2_POST_DIV_SHIFT 26 -+#define SUN4I_PLL2_POST_DIV_WIDTH 4 -+#define SUN4I_PLL2_POST_DIV_MASK GENMASK(SUN4I_PLL2_POST_DIV_WIDTH - 1, 0) -+ -+#define SUN4I_PLL2_POST_DIV_VALUE 4 -+ -+#define SUN4I_PLL2_OUTPUTS 4 -+ -+struct sun4i_pll2_data { -+ u32 post_div_offset; -+ u32 pre_div_flags; -+}; -+ -+static DEFINE_SPINLOCK(sun4i_a10_pll2_lock); -+ -+static void __init sun4i_pll2_setup(struct device_node *node, -+ struct sun4i_pll2_data *data) -+{ -+ const char *clk_name = node->name, *parent; -+ struct clk **clks, *base_clk, *prediv_clk; -+ struct clk_onecell_data *clk_data; -+ struct clk_multiplier *mult; -+ struct clk_gate *gate; -+ void __iomem *reg; -+ u32 val; -+ -+ reg = of_io_request_and_map(node, 0, of_node_full_name(node)); -+ if (IS_ERR(reg)) -+ return; -+ -+ clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); -+ if (!clk_data) -+ goto err_unmap; -+ -+ clks = kcalloc(SUN4I_PLL2_OUTPUTS, sizeof(struct clk *), GFP_KERNEL); -+ if (!clks) -+ goto err_free_data; -+ -+ parent = of_clk_get_parent_name(node, 0); -+ prediv_clk = clk_register_divider(NULL, "pll2-prediv", -+ parent, 0, reg, -+ SUN4I_PLL2_PRE_DIV_SHIFT, -+ SUN4I_PLL2_PRE_DIV_WIDTH, -+ data->pre_div_flags, -+ &sun4i_a10_pll2_lock); -+ if (!prediv_clk) { -+ pr_err("Couldn't register the prediv clock\n"); -+ goto err_free_array; -+ } -+ -+ /* Setup the gate part of the PLL2 */ -+ gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); -+ if (!gate) -+ goto err_unregister_prediv; -+ -+ gate->reg = reg; -+ gate->bit_idx = SUN4I_PLL2_ENABLE; -+ gate->lock = &sun4i_a10_pll2_lock; -+ -+ /* Setup the multiplier part of the PLL2 */ -+ mult = kzalloc(sizeof(struct clk_multiplier), GFP_KERNEL); -+ if (!mult) -+ goto err_free_gate; -+ -+ mult->reg = reg; -+ mult->shift = SUN4I_PLL2_N_SHIFT; -+ mult->width = 7; -+ mult->flags = CLK_MULTIPLIER_ZERO_BYPASS | -+ CLK_MULTIPLIER_ROUND_CLOSEST; -+ mult->lock = &sun4i_a10_pll2_lock; -+ -+ parent = __clk_get_name(prediv_clk); -+ base_clk = clk_register_composite(NULL, "pll2-base", -+ &parent, 1, -+ NULL, NULL, -+ &mult->hw, &clk_multiplier_ops, -+ &gate->hw, &clk_gate_ops, -+ CLK_SET_RATE_PARENT); -+ if (!base_clk) { -+ pr_err("Couldn't register the base multiplier clock\n"); -+ goto err_free_multiplier; -+ } -+ -+ parent = __clk_get_name(base_clk); -+ -+ /* -+ * PLL2-1x -+ * -+ * This is supposed to have a post divider, but we won't need -+ * to use it, we just need to initialise it to 4, and use a -+ * fixed divider. -+ */ -+ val = readl(reg); -+ val &= ~(SUN4I_PLL2_POST_DIV_MASK << SUN4I_PLL2_POST_DIV_SHIFT); -+ val |= (SUN4I_PLL2_POST_DIV_VALUE - data->post_div_offset) << SUN4I_PLL2_POST_DIV_SHIFT; -+ writel(val, reg); -+ -+ of_property_read_string_index(node, "clock-output-names", -+ SUN4I_A10_PLL2_1X, &clk_name); -+ clks[SUN4I_A10_PLL2_1X] = clk_register_fixed_factor(NULL, clk_name, -+ parent, -+ CLK_SET_RATE_PARENT, -+ 1, -+ SUN4I_PLL2_POST_DIV_VALUE); -+ WARN_ON(IS_ERR(clks[SUN4I_A10_PLL2_1X])); -+ -+ /* -+ * PLL2-2x -+ * -+ * This clock doesn't use the post divider, and really is just -+ * a fixed divider from the PLL2 base clock. -+ */ -+ of_property_read_string_index(node, "clock-output-names", -+ SUN4I_A10_PLL2_2X, &clk_name); -+ clks[SUN4I_A10_PLL2_2X] = clk_register_fixed_factor(NULL, clk_name, -+ parent, -+ CLK_SET_RATE_PARENT, -+ 1, 2); -+ WARN_ON(IS_ERR(clks[SUN4I_A10_PLL2_2X])); -+ -+ /* PLL2-4x */ -+ of_property_read_string_index(node, "clock-output-names", -+ SUN4I_A10_PLL2_4X, &clk_name); -+ clks[SUN4I_A10_PLL2_4X] = clk_register_fixed_factor(NULL, clk_name, -+ parent, -+ CLK_SET_RATE_PARENT, -+ 1, 1); -+ WARN_ON(IS_ERR(clks[SUN4I_A10_PLL2_4X])); -+ -+ /* PLL2-8x */ -+ of_property_read_string_index(node, "clock-output-names", -+ SUN4I_A10_PLL2_8X, &clk_name); -+ clks[SUN4I_A10_PLL2_8X] = clk_register_fixed_factor(NULL, clk_name, -+ parent, -+ CLK_SET_RATE_PARENT, -+ 2, 1); -+ WARN_ON(IS_ERR(clks[SUN4I_A10_PLL2_8X])); -+ -+ clk_data->clks = clks; -+ clk_data->clk_num = SUN4I_PLL2_OUTPUTS; -+ of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); -+ -+ return; -+ -+err_free_multiplier: -+ kfree(mult); -+err_free_gate: -+ kfree(gate); -+err_unregister_prediv: -+ clk_unregister_divider(prediv_clk); -+err_free_array: -+ kfree(clks); -+err_free_data: -+ kfree(clk_data); -+err_unmap: -+ iounmap(reg); -+} -+ -+static struct sun4i_pll2_data sun4i_a10_pll2_data = { -+ .pre_div_flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, -+}; -+ -+static void __init sun4i_a10_pll2_setup(struct device_node *node) -+{ -+ sun4i_pll2_setup(node, &sun4i_a10_pll2_data); -+} -+ -+CLK_OF_DECLARE(sun4i_a10_pll2, "allwinner,sun4i-a10-pll2-clk", -+ sun4i_a10_pll2_setup); -+ -+static struct sun4i_pll2_data sun5i_a13_pll2_data = { -+ .post_div_offset = 1, -+}; -+ -+static void __init sun5i_a13_pll2_setup(struct device_node *node) -+{ -+ sun4i_pll2_setup(node, &sun5i_a13_pll2_data); -+} -+ -+CLK_OF_DECLARE(sun5i_a13_pll2, "allwinner,sun5i-a13-pll2-clk", -+ sun5i_a13_pll2_setup); -diff --git a/drivers/clk/sunxi/clk-simple-gates.c b/drivers/clk/sunxi/clk-simple-gates.c -index 6ce9118..0214c65 100644 ---- a/drivers/clk/sunxi/clk-simple-gates.c -+++ b/drivers/clk/sunxi/clk-simple-gates.c -@@ -128,6 +128,8 @@ CLK_OF_DECLARE(sun8i_a23_apb1, "allwinner,sun8i-a23-apb1-gates-clk", - sunxi_simple_gates_init); - CLK_OF_DECLARE(sun8i_a23_apb2, "allwinner,sun8i-a23-apb2-gates-clk", - sunxi_simple_gates_init); -+CLK_OF_DECLARE(sun8i_a33_ahb1, "allwinner,sun8i-a33-ahb1-gates-clk", -+ sunxi_simple_gates_init); - CLK_OF_DECLARE(sun9i_a80_ahb0, "allwinner,sun9i-a80-ahb0-gates-clk", - sunxi_simple_gates_init); - CLK_OF_DECLARE(sun9i_a80_ahb1, "allwinner,sun9i-a80-ahb1-gates-clk", -diff --git a/include/dt-bindings/clock/bcm2835.h b/include/dt-bindings/clock/bcm2835.h -new file mode 100644 -index 0000000..d323efa ---- /dev/null -+++ b/include/dt-bindings/clock/bcm2835.h -@@ -0,0 +1,47 @@ -+/* -+ * Copyright (C) 2015 Broadcom Corporation -+ * -+ * 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 version 2. -+ * -+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any -+ * kind, whether express or implied; without even the implied warranty -+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#define BCM2835_PLLA 0 -+#define BCM2835_PLLB 1 -+#define BCM2835_PLLC 2 -+#define BCM2835_PLLD 3 -+#define BCM2835_PLLH 4 -+ -+#define BCM2835_PLLA_CORE 5 -+#define BCM2835_PLLA_PER 6 -+#define BCM2835_PLLB_ARM 7 -+#define BCM2835_PLLC_CORE0 8 -+#define BCM2835_PLLC_CORE1 9 -+#define BCM2835_PLLC_CORE2 10 -+#define BCM2835_PLLC_PER 11 -+#define BCM2835_PLLD_CORE 12 -+#define BCM2835_PLLD_PER 13 -+#define BCM2835_PLLH_RCAL 14 -+#define BCM2835_PLLH_AUX 15 -+#define BCM2835_PLLH_PIX 16 -+ -+#define BCM2835_CLOCK_TIMER 17 -+#define BCM2835_CLOCK_OTP 18 -+#define BCM2835_CLOCK_UART 19 -+#define BCM2835_CLOCK_VPU 20 -+#define BCM2835_CLOCK_V3D 21 -+#define BCM2835_CLOCK_ISP 22 -+#define BCM2835_CLOCK_H264 23 -+#define BCM2835_CLOCK_VEC 24 -+#define BCM2835_CLOCK_HSM 25 -+#define BCM2835_CLOCK_SDRAM 26 -+#define BCM2835_CLOCK_TSENS 27 -+#define BCM2835_CLOCK_EMMC 28 -+#define BCM2835_CLOCK_PERI_IMAGE 29 -+ -+#define BCM2835_CLOCK_COUNT 30 -diff --git a/include/dt-bindings/clock/sun4i-a10-pll2.h b/include/dt-bindings/clock/sun4i-a10-pll2.h -new file mode 100644 -index 0000000..071c811 ---- /dev/null -+++ b/include/dt-bindings/clock/sun4i-a10-pll2.h -@@ -0,0 +1,53 @@ -+/* -+ * Copyright 2015 Maxime Ripard -+ * -+ * Maxime Ripard -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+#ifndef __DT_BINDINGS_CLOCK_SUN4I_A10_PLL2_H_ -+#define __DT_BINDINGS_CLOCK_SUN4I_A10_PLL2_H_ -+ -+#define SUN4I_A10_PLL2_1X 0 -+#define SUN4I_A10_PLL2_2X 1 -+#define SUN4I_A10_PLL2_4X 2 -+#define SUN4I_A10_PLL2_8X 3 -+ -+#endif /* __DT_BINDINGS_CLOCK_SUN4I_A10_PLL2_H_ */ -diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h -index 3ecc07d..6a7dfe3 100644 ---- a/include/linux/clk-provider.h -+++ b/include/linux/clk-provider.h -@@ -518,6 +518,48 @@ struct clk *clk_register_fractional_divider(struct device *dev, - void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth, - u8 clk_divider_flags, spinlock_t *lock); - -+/** -+ * struct clk_multiplier - adjustable multiplier clock -+ * -+ * @hw: handle between common and hardware-specific interfaces -+ * @reg: register containing the multiplier -+ * @shift: shift to the multiplier bit field -+ * @width: width of the multiplier bit field -+ * @lock: register lock -+ * -+ * Clock with an adjustable multiplier affecting its output frequency. -+ * Implements .recalc_rate, .set_rate and .round_rate -+ * -+ * Flags: -+ * CLK_MULTIPLIER_ZERO_BYPASS - By default, the multiplier is the value read -+ * from the register, with 0 being a valid value effectively -+ * zeroing the output clock rate. If CLK_MULTIPLIER_ZERO_BYPASS is -+ * set, then a null multiplier will be considered as a bypass, -+ * leaving the parent rate unmodified. -+ * CLK_MULTIPLIER_ROUND_CLOSEST - Makes the best calculated divider to be -+ * rounded to the closest integer instead of the down one. -+ */ -+struct clk_multiplier { -+ struct clk_hw hw; -+ void __iomem *reg; -+ u8 shift; -+ u8 width; -+ u8 flags; -+ spinlock_t *lock; -+}; -+ -+#define CLK_MULTIPLIER_ZERO_BYPASS BIT(0) -+#define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1) -+ -+extern const struct clk_ops clk_multiplier_ops; -+ -+struct clk *clk_register_multiplier(struct device *dev, const char *name, -+ const char *parent_name, -+ unsigned long flags, -+ void __iomem *reg, u8 shift, u8 width, -+ u8 clk_mult_flags, spinlock_t *lock); -+void clk_unregister_multiplier(struct clk *clk); -+ - /*** - * struct clk_composite - aggregate clock of mux, divider and gate clocks - * -generated by cgit v0.11.2 at 2015-11-04 11:28:59 (GMT) diff --git a/patch/kernel/aufs3-base.patch b/patch/kernel/aufs3-base.patch deleted file mode 100644 index d639d79bd..000000000 --- a/patch/kernel/aufs3-base.patch +++ /dev/null @@ -1,70 +0,0 @@ -aufs3.4 base patch - -diff --git a/fs/namei.c b/fs/namei.c -index c427919..7ff959b 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -1831,7 +1831,7 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, - * needs parent already locked. Doesn't follow mounts. - * SMP-safe. - */ --static struct dentry *lookup_hash(struct nameidata *nd) -+struct dentry *lookup_hash(struct nameidata *nd) - { - return __lookup_hash(&nd->last, nd->path.dentry, nd); - } -diff --git a/fs/splice.c b/fs/splice.c -index f847684..f871233 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1084,8 +1084,8 @@ EXPORT_SYMBOL(generic_splice_sendpage); - /* - * Attempt to initiate a splice from pipe to file. - */ --static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, -- loff_t *ppos, size_t len, unsigned int flags) -+long do_splice_from(struct pipe_inode_info *pipe, struct file *out, -+ loff_t *ppos, size_t len, unsigned int flags) - { - ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, - loff_t *, size_t, unsigned int); -@@ -1112,9 +1112,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, - /* - * Attempt to initiate a splice from a file to a pipe. - */ --static long do_splice_to(struct file *in, loff_t *ppos, -- struct pipe_inode_info *pipe, size_t len, -- unsigned int flags) -+long do_splice_to(struct file *in, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags) - { - ssize_t (*splice_read)(struct file *, loff_t *, - struct pipe_inode_info *, size_t, unsigned int); -diff --git a/include/linux/namei.h b/include/linux/namei.h -index ffc0213..ef35a31 100644 ---- a/include/linux/namei.h -+++ b/include/linux/namei.h -@@ -85,6 +85,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *, - extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, - int (*open)(struct inode *, struct file *)); - -+extern struct dentry *lookup_hash(struct nameidata *nd); - extern struct dentry *lookup_one_len(const char *, struct dentry *, int); - - extern int follow_down_one(struct path *); -diff --git a/include/linux/splice.h b/include/linux/splice.h -index 26e5b61..3ffef2f 100644 ---- a/include/linux/splice.h -+++ b/include/linux/splice.h -@@ -91,4 +91,10 @@ extern void splice_shrink_spd(struct pipe_inode_info *, - extern void spd_release_page(struct splice_pipe_desc *, unsigned int); - - extern const struct pipe_buf_operations page_cache_pipe_buf_ops; -+ -+extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out, -+ loff_t *ppos, size_t len, unsigned int flags); -+extern long do_splice_to(struct file *in, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags); - #endif diff --git a/patch/kernel/aufs3-kbuild.patch b/patch/kernel/aufs3-kbuild.patch deleted file mode 100644 index 345704994..000000000 --- a/patch/kernel/aufs3-kbuild.patch +++ /dev/null @@ -1,38 +0,0 @@ -aufs3.4 kbuild patch - -diff --git a/fs/Kconfig b/fs/Kconfig -index f95ae3a..6d8a9a5 100644 ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -220,6 +220,7 @@ source "fs/pstore/Kconfig" - source "fs/sysv/Kconfig" - source "fs/ufs/Kconfig" - source "fs/exofs/Kconfig" -+source "fs/aufs/Kconfig" - - endif # MISC_FILESYSTEMS - -diff --git a/fs/Makefile b/fs/Makefile -index 2fb9779..abefac5 100644 ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -125,6 +125,6 @@ - obj-y += exofs/ # Multiple modules - obj-$(CONFIG_CEPH_FS) += ceph/ - obj-$(CONFIG_PSTORE) += pstore/ -- -+obj-$(CONFIG_AUFS_FS) += aufs/ - # Patched by YAFFS - obj-$(CONFIG_YAFFS_FS) += yaffs2/ -diff --git a/include/linux/Kbuild b/include/linux/Kbuild -index 3c9b616..8704efa 100644 ---- a/include/linux/Kbuild -+++ b/include/linux/Kbuild -@@ -66,6 +66,7 @@ header-y += atmppp.h - header-y += atmsap.h - header-y += atmsvc.h - header-y += audit.h -+header-y += aufs_type.h - header-y += auto_fs.h - header-y += auto_fs4.h - header-y += auxvec.h diff --git a/patch/kernel/aufs3-mmap.patch b/patch/kernel/aufs3-mmap.patch deleted file mode 100644 index 30b23067d..000000000 --- a/patch/kernel/aufs3-mmap.patch +++ /dev/null @@ -1,349 +0,0 @@ -aufs3.4 mmap patch - -diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c -index b1822dd..d8518aa 100644 ---- a/fs/proc/nommu.c -+++ b/fs/proc/nommu.c -@@ -45,7 +45,9 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region) - file = region->vm_file; - - if (file) { -- struct inode *inode = region->vm_file->f_path.dentry->d_inode; -+ struct inode *inode; -+ file = vmr_pr_or_file(region); -+ inode = file->f_path.dentry->d_inode; - dev = inode->i_sb->s_dev; - ino = inode->i_ino; - } -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 1030a71..748aa74 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -225,7 +225,9 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) - const char *name = NULL; - - if (file) { -- struct inode *inode = vma->vm_file->f_path.dentry->d_inode; -+ struct inode *inode; -+ file = vma_pr_or_file(vma); -+ inode = file->f_path.dentry->d_inode; - dev = inode->i_sb->s_dev; - ino = inode->i_ino; - pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; -@@ -1158,6 +1160,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) - seq_printf(m, "%08lx %s", vma->vm_start, buffer); - - if (file) { -+ file = vma_pr_or_file(vma); - seq_printf(m, " file="); - seq_path(m, &file->f_path, "\n\t= "); - } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { -diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c -index 74fe164..ff3ef72 100644 ---- a/fs/proc/task_nommu.c -+++ b/fs/proc/task_nommu.c -@@ -149,7 +149,9 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, - file = vma->vm_file; - - if (file) { -- struct inode *inode = vma->vm_file->f_path.dentry->d_inode; -+ struct inode *inode; -+ file = vma_pr_or_file(file); -+ inode = file->f_path.dentry->d_inode; - dev = inode->i_sb->s_dev; - ino = inode->i_ino; - pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; -diff --git a/include/linux/mm.h b/include/linux/mm.h -index 74aa71b..f4aabab9 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -18,6 +18,9 @@ - #include - #include - #include -+#include -+#include -+#include - - struct mempolicy; - struct anon_vma; -@@ -984,6 +987,87 @@ static inline int fixup_user_fault(struct task_struct *tsk, - } - #endif - -+/* -+ * Mainly for aufs which mmap(2) diffrent file and wants to print different path -+ * in /proc/PID/maps. -+ */ -+/* #define AUFS_DEBUG_MMAP */ -+static inline void aufs_trace(struct file *f, struct file *pr, -+ const char func[], int line, const char func2[]) -+{ -+#ifdef AUFS_DEBUG_MMAP -+ if (pr) -+ pr_info("%s:%d: %s, %p\n", func, line, func2, -+ f ? (char *)f->f_dentry->d_name.name : "(null)"); -+#endif -+} -+ -+static inline struct file *vmr_do_pr_or_file(struct vm_region *region, -+ const char func[], int line) -+{ -+ struct file *f = region->vm_file, *pr = region->vm_prfile; -+ aufs_trace(f, pr, func, line, __func__); -+ return (f && pr) ? pr : f; -+} -+ -+static inline void vmr_do_fput(struct vm_region *region, -+ const char func[], int line) -+{ -+ struct file *f = region->vm_file, *pr = region->vm_prfile; -+ aufs_trace(f, pr, func, line, __func__); -+ fput(f); -+ if (f && pr) -+ fput(pr); -+} -+ -+static inline void vma_do_file_update_time(struct vm_area_struct *vma, -+ const char func[], int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ aufs_trace(f, pr, func, line, __func__); -+ file_update_time(f); -+ if (f && pr) -+ file_update_time(pr); -+} -+ -+static inline struct file *vma_do_pr_or_file(struct vm_area_struct *vma, -+ const char func[], int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ aufs_trace(f, pr, func, line, __func__); -+ return (f && pr) ? pr : f; -+} -+ -+static inline void vma_do_get_file(struct vm_area_struct *vma, -+ const char func[], int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ aufs_trace(f, pr, func, line, __func__); -+ get_file(f); -+ if (f && pr) -+ get_file(pr); -+} -+ -+static inline void vma_do_fput(struct vm_area_struct *vma, -+ const char func[], int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ aufs_trace(f, pr, func, line, __func__); -+ fput(f); -+ if (f && pr) -+ fput(pr); -+} -+ -+#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \ -+ __LINE__) -+#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__) -+#define vma_file_update_time(vma) vma_do_file_update_time(vma, __func__, \ -+ __LINE__) -+#define vma_pr_or_file(vma) vma_do_pr_or_file(vma, __func__, \ -+ __LINE__) -+#define vma_get_file(vma) vma_do_get_file(vma, __func__, __LINE__) -+#define vma_fput(vma) vma_do_fput(vma, __func__, __LINE__) -+ - extern int make_pages_present(unsigned long addr, unsigned long end); - extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); - extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, -diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h -index 3cc3062..9742239 100644 ---- a/include/linux/mm_types.h -+++ b/include/linux/mm_types.h -@@ -185,6 +185,7 @@ struct vm_region { - unsigned long vm_top; /* region allocated to here */ - unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ - struct file *vm_file; /* the backing file or NULL */ -+ struct file *vm_prfile; /* the virtual backing file or NULL */ - - int vm_usage; /* region usage count (access under nommu_region_sem) */ - bool vm_icache_flushed : 1; /* true if the icache has been flushed for -@@ -244,6 +245,7 @@ struct vm_area_struct { - unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE - units, *not* PAGE_CACHE_SIZE */ - struct file * vm_file; /* File we map to (can be NULL). */ -+ struct file *vm_prfile; /* shadow of vm_file */ - void * vm_private_data; /* was vm_pte (shared mem) */ - - #ifndef CONFIG_MMU -diff --git a/kernel/fork.c b/kernel/fork.c -index 687a15d..fe47fd0 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -381,7 +381,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) - struct inode *inode = file->f_path.dentry->d_inode; - struct address_space *mapping = file->f_mapping; - -- get_file(file); -+ vma_get_file(tmp); - if (tmp->vm_flags & VM_DENYWRITE) - atomic_dec(&inode->i_writecount); - mutex_lock(&mapping->i_mmap_mutex); -diff --git a/mm/fremap.c b/mm/fremap.c -index 9ed4fd4..00ee66b 100644 ---- a/mm/fremap.c -+++ b/mm/fremap.c -@@ -198,10 +198,10 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, - struct file *file = vma->vm_file; - - flags &= MAP_NONBLOCK; -- get_file(file); -+ vma_get_file(vma); - addr = mmap_region(file, start, size, - flags, vma->vm_flags, pgoff); -- fput(file); -+ vma_fput(vma); - if (IS_ERR_VALUE(addr)) { - err = addr; - } else { -diff --git a/mm/memory.c b/mm/memory.c -index 6105f47..9bdc45d 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -2652,7 +2652,7 @@ reuse: - - /* file_update_time outside page_lock */ - if (vma->vm_file) -- file_update_time(vma->vm_file); -+ vma_file_update_time(vma); - - return ret; - } -@@ -3337,7 +3337,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, - - /* file_update_time outside page_lock */ - if (vma->vm_file) -- file_update_time(vma->vm_file); -+ vma_file_update_time(vma); - } else { - unlock_page(vmf.page); - if (anon) -diff --git a/mm/mmap.c b/mm/mmap.c -index 848ef52..423d68f 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -231,7 +231,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) - if (vma->vm_ops && vma->vm_ops->close) - vma->vm_ops->close(vma); - if (vma->vm_file) { -- fput(vma->vm_file); -+ vma_fput(vma); - if (vma->vm_flags & VM_EXECUTABLE) - removed_exe_file_vma(vma->vm_mm); - } -@@ -619,7 +619,7 @@ again: remove_next = 1 + (end > next->vm_end); - - if (remove_next) { - if (file) { -- fput(file); -+ vma_fput(vma); - if (next->vm_flags & VM_EXECUTABLE) - removed_exe_file_vma(mm); - } -@@ -1376,8 +1376,8 @@ out: - unmap_and_free_vma: - if (correct_wcount) - atomic_inc(&inode->i_writecount); -+ vma_fput(vma); - vma->vm_file = NULL; -- fput(file); - - /* Undo any partial mapping done by a device driver. */ - unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); -@@ -1998,7 +1998,7 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, - goto out_free_mpol; - - if (new->vm_file) { -- get_file(new->vm_file); -+ vma_get_file(new); - if (vma->vm_flags & VM_EXECUTABLE) - added_exe_file_vma(mm); - } -@@ -2022,7 +2022,7 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, - if (new->vm_file) { - if (vma->vm_flags & VM_EXECUTABLE) - removed_exe_file_vma(mm); -- fput(new->vm_file); -+ vma_fput(new); - } - unlink_anon_vmas(new); - out_free_mpol: -@@ -2420,7 +2420,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, - new_vma->vm_end = addr + len; - new_vma->vm_pgoff = pgoff; - if (new_vma->vm_file) { -- get_file(new_vma->vm_file); -+ vma_get_file(new_vma); - if (vma->vm_flags & VM_EXECUTABLE) - added_exe_file_vma(mm); - } -diff --git a/mm/msync.c b/mm/msync.c -index 632df45..02d770e 100644 ---- a/mm/msync.c -+++ b/mm/msync.c -@@ -80,10 +80,10 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) - start = vma->vm_end; - if ((flags & MS_SYNC) && file && - (vma->vm_flags & VM_SHARED)) { -- get_file(file); -+ vma_get_file(vma); - up_read(&mm->mmap_sem); - error = vfs_fsync(file, 0); -- fput(file); -+ vma_fput(vma); - if (error || start >= end) - goto out; - down_read(&mm->mmap_sem); -diff --git a/mm/nommu.c b/mm/nommu.c -index bb8f4f0..2bc7252 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -632,7 +632,7 @@ static void __put_nommu_region(struct vm_region *region) - up_write(&nommu_region_sem); - - if (region->vm_file) -- fput(region->vm_file); -+ vmr_fput(region); - - /* IO memory and memory shared directly out of the pagecache - * from ramfs/tmpfs mustn't be released here */ -@@ -790,7 +790,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma) - if (vma->vm_ops && vma->vm_ops->close) - vma->vm_ops->close(vma); - if (vma->vm_file) { -- fput(vma->vm_file); -+ vma_fput(vma); - if (vma->vm_flags & VM_EXECUTABLE) - removed_exe_file_vma(mm); - } -@@ -1363,7 +1363,7 @@ static unsigned long do_mmap_pgoff(struct file *file, - goto error_just_free; - } - } -- fput(region->vm_file); -+ vmr_fput(region); - kmem_cache_free(vm_region_jar, region); - region = pregion; - result = start; -@@ -1439,10 +1439,10 @@ error_just_free: - up_write(&nommu_region_sem); - error: - if (region->vm_file) -- fput(region->vm_file); -+ vmr_fput(region); - kmem_cache_free(vm_region_jar, region); - if (vma->vm_file) -- fput(vma->vm_file); -+ vma_fput(vma); - if (vma->vm_flags & VM_EXECUTABLE) - removed_exe_file_vma(vma->vm_mm); - kmem_cache_free(vm_area_cachep, vma); diff --git a/patch/kernel/aufs3-standalone.patch b/patch/kernel/aufs3-standalone.patch deleted file mode 100644 index 67cd853bd..000000000 --- a/patch/kernel/aufs3-standalone.patch +++ /dev/null @@ -1,257 +0,0 @@ -aufs3.4 standalone patch - -diff --git a/fs/file_table.c b/fs/file_table.c -index 70f2a0f..146a3d7 100644 ---- a/fs/file_table.c -+++ b/fs/file_table.c -@@ -442,6 +442,8 @@ void file_sb_list_del(struct file *file) - } - } - -+EXPORT_SYMBOL(file_sb_list_del); -+ - #ifdef CONFIG_SMP - - /* -diff --git a/fs/inode.c b/fs/inode.c -index 9f4f5fe..bb0f3ba 100644 ---- a/fs/inode.c -+++ b/fs/inode.c -@@ -56,6 +56,7 @@ static struct hlist_head *inode_hashtable __read_mostly; - static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock); - - __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_sb_list_lock); -+EXPORT_SYMBOL(inode_sb_list_lock); - - /* - * Empty aops. Can be used for the cases where the user does not -diff --git a/fs/namei.c b/fs/namei.c -index 7ff959b..b170167 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -1835,6 +1835,7 @@ struct dentry *lookup_hash(struct nameidata *nd) - { - return __lookup_hash(&nd->last, nd->path.dentry, nd); - } -+EXPORT_SYMBOL(lookup_hash); - - /** - * lookup_one_len - filesystem helper to lookup single pathname component -diff --git a/fs/namespace.c b/fs/namespace.c -index e608199..38fcc2e 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1339,6 +1339,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, - } - return 0; - } -+EXPORT_SYMBOL(iterate_mounts); - - static void cleanup_group_ids(struct mount *mnt, struct mount *end) - { -diff --git a/fs/notify/group.c b/fs/notify/group.c -index 63fc294..6f4adca 100644 ---- a/fs/notify/group.c -+++ b/fs/notify/group.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - #include - #include "fsnotify.h" -@@ -70,6 +71,7 @@ void fsnotify_put_group(struct fsnotify_group *group) - if (atomic_dec_and_test(&group->refcnt)) - fsnotify_destroy_group(group); - } -+EXPORT_SYMBOL(fsnotify_put_group); - - /* - * Create a new fsnotify_group and hold a reference for the group returned. -@@ -102,3 +104,4 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops) - - return group; - } -+EXPORT_SYMBOL(fsnotify_alloc_group); -diff --git a/fs/notify/mark.c b/fs/notify/mark.c -index f104d56..54f36db 100644 ---- a/fs/notify/mark.c -+++ b/fs/notify/mark.c -@@ -112,6 +112,7 @@ void fsnotify_put_mark(struct fsnotify_mark *mark) - if (atomic_dec_and_test(&mark->refcnt)) - mark->free_mark(mark); - } -+EXPORT_SYMBOL(fsnotify_put_mark); - - /* - * Any time a mark is getting freed we end up here. -@@ -191,6 +192,7 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark) - if (unlikely(atomic_dec_and_test(&group->num_marks))) - fsnotify_final_destroy_group(group); - } -+EXPORT_SYMBOL(fsnotify_destroy_mark); - - void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask) - { -@@ -278,6 +280,7 @@ err: - - return ret; - } -+EXPORT_SYMBOL(fsnotify_add_mark); - - /* - * clear any marks in a group in which mark->flags & flags is true -@@ -333,6 +336,7 @@ void fsnotify_init_mark(struct fsnotify_mark *mark, - atomic_set(&mark->refcnt, 1); - mark->free_mark = free_mark; - } -+EXPORT_SYMBOL(fsnotify_init_mark); - - static int fsnotify_mark_destroy(void *ignored) - { -diff --git a/fs/open.c b/fs/open.c -index 5720854..ec59242 100644 ---- a/fs/open.c -+++ b/fs/open.c -@@ -60,6 +60,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, - mutex_unlock(&dentry->d_inode->i_mutex); - return ret; - } -+EXPORT_SYMBOL(do_truncate); - - static long do_sys_truncate(const char __user *pathname, loff_t length) - { -diff --git a/fs/splice.c b/fs/splice.c -index f871233..70f5481 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1108,6 +1108,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out, - - return splice_write(pipe, out, ppos, len, flags); - } -+EXPORT_SYMBOL(do_splice_from); - - /* - * Attempt to initiate a splice from a file to a pipe. -@@ -1134,6 +1135,7 @@ long do_splice_to(struct file *in, loff_t *ppos, - - return splice_read(in, ppos, pipe, len, flags); - } -+EXPORT_SYMBOL(do_splice_to); - - /** - * splice_direct_to_actor - splices data directly between two non-pipes -diff --git a/security/commoncap.c b/security/commoncap.c -index 71a166a..5d63aac 100644 ---- a/security/commoncap.c -+++ b/security/commoncap.c -@@ -972,3 +972,4 @@ int cap_file_mmap(struct file *file, unsigned long reqprot, - } - return ret; - } -+EXPORT_SYMBOL(cap_file_mmap); -diff --git a/security/device_cgroup.c b/security/device_cgroup.c -index c43a332..0c37289 100644 ---- a/security/device_cgroup.c -+++ b/security/device_cgroup.c -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -499,6 +500,7 @@ found: - - return -EPERM; - } -+EXPORT_SYMBOL(__devcgroup_inode_permission); - - int devcgroup_inode_mknod(int mode, dev_t dev) - { -diff --git a/security/security.c b/security/security.c -index bf619ff..60b996a 100644 ---- a/security/security.c -+++ b/security/security.c -@@ -380,6 +380,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry) - return 0; - return security_ops->path_rmdir(dir, dentry); - } -+EXPORT_SYMBOL(security_path_rmdir); - - int security_path_unlink(struct path *dir, struct dentry *dentry) - { -@@ -396,6 +397,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry, - return 0; - return security_ops->path_symlink(dir, dentry, old_name); - } -+EXPORT_SYMBOL(security_path_symlink); - - int security_path_link(struct dentry *old_dentry, struct path *new_dir, - struct dentry *new_dentry) -@@ -404,6 +406,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, - return 0; - return security_ops->path_link(old_dentry, new_dir, new_dentry); - } -+EXPORT_SYMBOL(security_path_link); - - int security_path_rename(struct path *old_dir, struct dentry *old_dentry, - struct path *new_dir, struct dentry *new_dentry) -@@ -422,6 +425,7 @@ int security_path_truncate(struct path *path) - return 0; - return security_ops->path_truncate(path); - } -+EXPORT_SYMBOL(security_path_truncate); - - int security_path_chmod(struct path *path, umode_t mode) - { -@@ -429,6 +433,7 @@ int security_path_chmod(struct path *path, umode_t mode) - return 0; - return security_ops->path_chmod(path, mode); - } -+EXPORT_SYMBOL(security_path_chmod); - - int security_path_chown(struct path *path, uid_t uid, gid_t gid) - { -@@ -436,6 +441,7 @@ int security_path_chown(struct path *path, uid_t uid, gid_t gid) - return 0; - return security_ops->path_chown(path, uid, gid); - } -+EXPORT_SYMBOL(security_path_chown); - - int security_path_chroot(struct path *path) - { -@@ -512,6 +518,7 @@ int security_inode_readlink(struct dentry *dentry) - return 0; - return security_ops->inode_readlink(dentry); - } -+EXPORT_SYMBOL(security_inode_readlink); - - int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) - { -@@ -526,6 +533,7 @@ int security_inode_permission(struct inode *inode, int mask) - return 0; - return security_ops->inode_permission(inode, mask); - } -+EXPORT_SYMBOL(security_inode_permission); - - int security_inode_setattr(struct dentry *dentry, struct iattr *attr) - { -@@ -641,6 +649,7 @@ int security_file_permission(struct file *file, int mask) - - return fsnotify_perm(file, mask); - } -+EXPORT_SYMBOL(security_file_permission); - - int security_file_alloc(struct file *file) - { -@@ -668,6 +677,7 @@ int security_file_mmap(struct file *file, unsigned long reqprot, - return ret; - return ima_file_mmap(file, prot); - } -+EXPORT_SYMBOL(security_file_mmap); - - int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, - unsigned long prot) diff --git a/patch/kernel/h3-7498741.patch b/patch/kernel/h3-7498741.patch deleted file mode 100644 index 5608eb91c..000000000 --- a/patch/kernel/h3-7498741.patch +++ /dev/null @@ -1,119 +0,0 @@ -From patchwork Tue Oct 27 16:50:21 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4, - 1/6] clk: sunxi: Let divs clocks read the base factor clock name from - devicetree -From: Jens Kuske -X-Patchwork-Id: 7498741 -Message-Id: <1445964626-6484-2-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Tue, 27 Oct 2015 17:50:21 +0100 - -Currently, the sunxi clock driver gets the name for the base factor clock -of divs clocks from the name field in factors_data. This prevents reusing -of the factor clock for clocks with same properties, but different name. - -This commit makes the divs setup function try to get a name from -clock-output-names in the devicetree. It also removes the name field where -possible and merges the sun4i PLL5 and PLL6 clocks. - -Signed-off-by: Jens Kuske - ---- -drivers/clk/sunxi/clk-sunxi.c | 38 +++++++++++++++++++++++++++----------- - 1 file changed, 27 insertions(+), 11 deletions(-) - -diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c -index 9c79af0c..270de42 100644 ---- a/drivers/clk/sunxi/clk-sunxi.c -+++ b/drivers/clk/sunxi/clk-sunxi.c -@@ -704,21 +704,12 @@ static const struct factors_data sun4i_pll5_data __initconst = { - .enable = 31, - .table = &sun4i_pll5_config, - .getter = sun4i_get_pll5_factors, -- .name = "pll5", --}; -- --static const struct factors_data sun4i_pll6_data __initconst = { -- .enable = 31, -- .table = &sun4i_pll5_config, -- .getter = sun4i_get_pll5_factors, -- .name = "pll6", - }; - - static const struct factors_data sun6i_a31_pll6_data __initconst = { - .enable = 31, - .table = &sun6i_a31_pll6_config, - .getter = sun6i_a31_get_pll6_factors, -- .name = "pll6x2", - }; - - static const struct factors_data sun5i_a13_ahb_data __initconst = { -@@ -902,6 +893,7 @@ struct gates_data { - - #define SUNXI_DIVS_MAX_QTY 4 - #define SUNXI_DIVISOR_WIDTH 2 -+#define SUNXI_DIVS_BASE_NAME_MAX_LEN 8 - - struct divs_data { - const struct factors_data *factors; /* data for the factor clock */ -@@ -941,7 +933,7 @@ static const struct divs_data pll5_divs_data __initconst = { - }; - - static const struct divs_data pll6_divs_data __initconst = { -- .factors = &sun4i_pll6_data, -+ .factors = &sun4i_pll5_data, - .ndivs = 4, - .div = { - { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */ -@@ -983,6 +975,8 @@ static void __init sunxi_divs_clk_setup(struct device_node *node, - struct clk_gate *gate = NULL; - struct clk_fixed_factor *fix_factor; - struct clk_divider *divider; -+ struct factors_data factors = *data->factors; -+ char base_name[SUNXI_DIVS_BASE_NAME_MAX_LEN]; - void __iomem *reg; - int ndivs = SUNXI_DIVS_MAX_QTY, i = 0; - int flags, clkflags; -@@ -991,8 +985,30 @@ static void __init sunxi_divs_clk_setup(struct device_node *node, - if (data->ndivs) - ndivs = data->ndivs; - -+ /* Try to find a name for base factor clock */ -+ for (i = 0; i < ndivs; i++) { -+ if (data->div[i].self) { -+ of_property_read_string_index(node, "clock-output-names", -+ i, &factors.name); -+ break; -+ } -+ } -+ /* If we don't have a .self clk use the first output-name up to '_' */ -+ if (factors.name == NULL) { -+ of_property_read_string_index(node, "clock-output-names", -+ 0, &clk_name); -+ -+ for (i = 0; i < SUNXI_DIVS_BASE_NAME_MAX_LEN - 1 && -+ clk_name[i] != '_' && -+ clk_name[i] != '\0'; i++) -+ base_name[i] = clk_name[i]; -+ -+ base_name[i] = '\0'; -+ factors.name = base_name; -+ } -+ - /* Set up factor clock that we will be dividing */ -- pclk = sunxi_factors_clk_setup(node, data->factors); -+ pclk = sunxi_factors_clk_setup(node, &factors); - parent = __clk_get_name(pclk); - - reg = of_iomap(node, 0); diff --git a/patch/kernel/h3-7498751.patch b/patch/kernel/h3-7498751.patch deleted file mode 100644 index 3167c4c25..000000000 --- a/patch/kernel/h3-7498751.patch +++ /dev/null @@ -1,232 +0,0 @@ -From patchwork Tue Oct 27 16:50:22 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,2/6] clk: sunxi: Add H3 clocks support -From: Jens Kuske -X-Patchwork-Id: 7498751 -Message-Id: <1445964626-6484-3-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Tue, 27 Oct 2015 17:50:22 +0100 - -The H3 clock control unit is similar to the those of other sun8i family -members like the A23. - -It adds a new bus gates clock similar to the simple gates, but with a -different parent clock for each single gate. -Some of the gates use the new AHB2 clock as parent, whose clock source -is muxable between AHB1 and PLL6/2. The documentation isn't totally clear -about which devices belong to AHB2 now, especially USB EHIC/OHIC, so it -is mostly based on Allwinner kernel source code. - -Signed-off-by: Jens Kuske - ---- -Documentation/devicetree/bindings/clock/sunxi.txt | 2 + - drivers/clk/sunxi/Makefile | 1 + - drivers/clk/sunxi/clk-sun8i-bus-gates.c | 111 ++++++++++++++++++++++ - drivers/clk/sunxi/clk-sunxi.c | 9 +- - 4 files changed, 122 insertions(+), 1 deletion(-) - create mode 100644 drivers/clk/sunxi/clk-sun8i-bus-gates.c - -diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt -index 8a47b77..d303dec 100644 ---- a/Documentation/devicetree/bindings/clock/sunxi.txt -+++ b/Documentation/devicetree/bindings/clock/sunxi.txt -@@ -28,6 +28,7 @@ Required properties: - "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20 - "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31 - "allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31 -+ "allwinner,sun8i-h3-ahb2-clk" - for the AHB2 clock on H3 - "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31 - "allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23 - "allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80 -@@ -55,6 +56,7 @@ Required properties: - "allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80 - "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31 - "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 -+ "allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3 - "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 - "allwinner,sun4i-a10-mmc-clk" - for the MMC clock - "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80 -diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile -index cb4c299..f520af6 100644 ---- a/drivers/clk/sunxi/Makefile -+++ b/drivers/clk/sunxi/Makefile -@@ -10,6 +10,7 @@ obj-y += clk-a10-pll2.o - obj-y += clk-a20-gmac.o - obj-y += clk-mod0.o - obj-y += clk-simple-gates.o -+obj-y += clk-sun8i-bus-gates.o - obj-y += clk-sun8i-mbus.o - obj-y += clk-sun9i-core.o - obj-y += clk-sun9i-mmc.o -diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c -new file mode 100644 -index 0000000..ad605fa ---- /dev/null -+++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c -@@ -0,0 +1,111 @@ -+/* -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * Based on clk-simple-gates.c, which is: -+ * Copyright 2015 Maxime Ripard -+ * -+ * Maxime Ripard -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static DEFINE_SPINLOCK(gates_lock); -+ -+static void __init sun8i_h3_bus_gates_init(struct device_node *node) -+{ -+ const char *clocks[] = { "ahb1", "ahb2", "apb1", "apb2" }; -+ enum { AHB1, AHB2, APB1, APB2 } clk_parent; -+ struct clk_onecell_data *clk_data; -+ const char *clk_name; -+ struct property *prop; -+ struct resource res; -+ void __iomem *clk_reg; -+ void __iomem *reg; -+ const __be32 *p; -+ int number, i; -+ u8 clk_bit; -+ u32 index; -+ -+ reg = of_io_request_and_map(node, 0, of_node_full_name(node)); -+ if (IS_ERR(reg)) -+ return; -+ -+ for (i = 0; i < ARRAY_SIZE(clocks); i++) { -+ index = of_property_match_string(node, "clock-names", clocks[i]); -+ if (index < 0) -+ return; -+ -+ clocks[i] = of_clk_get_parent_name(node, index); -+ } -+ -+ clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); -+ if (!clk_data) -+ goto err_unmap; -+ -+ number = of_property_count_u32_elems(node, "clock-indices"); -+ of_property_read_u32_index(node, "clock-indices", number - 1, &number); -+ -+ clk_data->clks = kcalloc(number + 1, sizeof(struct clk *), GFP_KERNEL); -+ if (!clk_data->clks) -+ goto err_free_data; -+ -+ i = 0; -+ of_property_for_each_u32(node, "clock-indices", prop, p, index) { -+ of_property_read_string_index(node, "clock-output-names", -+ i, &clk_name); -+ -+ if (index == 17 || (index >= 29 && index <= 31)) -+ clk_parent = AHB2; -+ else if (index <= 63 || index >= 128) -+ clk_parent = AHB1; -+ else if (index >= 64 && index <= 95) -+ clk_parent = APB1; -+ else if (index >= 96 && index <= 127) -+ clk_parent = APB2; -+ -+ clk_reg = reg + 4 * (index / 32); -+ clk_bit = index % 32; -+ -+ clk_data->clks[index] = clk_register_gate(NULL, clk_name, -+ clocks[clk_parent], 0, -+ clk_reg, -+ clk_bit, -+ 0, &gates_lock); -+ i++; -+ -+ if (IS_ERR(clk_data->clks[index])) { -+ WARN_ON(true); -+ continue; -+ } -+ } -+ -+ clk_data->clk_num = number + 1; -+ of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); -+ -+ return; -+ -+err_free_data: -+ kfree(clk_data); -+err_unmap: -+ iounmap(reg); -+ of_address_to_resource(node, 0, &res); -+ release_mem_region(res.start, resource_size(&res)); -+} -+ -+CLK_OF_DECLARE(sun8i_h3_bus_gates, "allwinner,sun8i-h3-bus-gates-clk", -+ sun8i_h3_bus_gates_init); -diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c -index 270de42..6293c65 100644 ---- a/drivers/clk/sunxi/clk-sunxi.c -+++ b/drivers/clk/sunxi/clk-sunxi.c -@@ -769,6 +769,10 @@ static const struct mux_data sun6i_a31_ahb1_mux_data __initconst = { - .shift = 12, - }; - -+static const struct mux_data sun8i_h3_ahb2_mux_data __initconst = { -+ .shift = 0, -+}; -+ - static void __init sunxi_mux_clk_setup(struct device_node *node, - struct mux_data *data) - { -@@ -945,10 +949,11 @@ static const struct divs_data pll6_divs_data __initconst = { - - static const struct divs_data sun6i_a31_pll6_divs_data __initconst = { - .factors = &sun6i_a31_pll6_data, -- .ndivs = 2, -+ .ndivs = 3, - .div = { - { .fixed = 2 }, /* normal output */ - { .self = 1 }, /* base factor clock, 2x */ -+ { .fixed = 4 }, /* divided output, /2 */ - } - }; - -@@ -1146,6 +1151,7 @@ static const struct of_device_id clk_divs_match[] __initconst = { - static const struct of_device_id clk_mux_match[] __initconst = { - {.compatible = "allwinner,sun4i-a10-cpu-clk", .data = &sun4i_cpu_mux_data,}, - {.compatible = "allwinner,sun6i-a31-ahb1-mux-clk", .data = &sun6i_a31_ahb1_mux_data,}, -+ {.compatible = "allwinner,sun8i-h3-ahb2-clk", .data = &sun8i_h3_ahb2_mux_data,}, - {} - }; - -@@ -1228,6 +1234,7 @@ CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sun6i_init_clocks); - CLK_OF_DECLARE(sun6i_a31s_clk_init, "allwinner,sun6i-a31s", sun6i_init_clocks); - CLK_OF_DECLARE(sun8i_a23_clk_init, "allwinner,sun8i-a23", sun6i_init_clocks); - CLK_OF_DECLARE(sun8i_a33_clk_init, "allwinner,sun8i-a33", sun6i_init_clocks); -+CLK_OF_DECLARE(sun8i_h3_clk_init, "allwinner,sun8i-h3", sun6i_init_clocks); - - static void __init sun9i_init_clocks(struct device_node *node) - { diff --git a/patch/kernel/h3-7498761.patch b/patch/kernel/h3-7498761.patch deleted file mode 100644 index eeaa6d398..000000000 --- a/patch/kernel/h3-7498761.patch +++ /dev/null @@ -1,110 +0,0 @@ -From patchwork Tue Oct 27 16:50:24 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,4/6] reset: sunxi: Add Allwinner H3 bus resets -From: Jens Kuske -X-Patchwork-Id: 7498761 -Message-Id: <1445964626-6484-5-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Tue, 27 Oct 2015 17:50:24 +0100 - -The H3 bus resets have some holes between the registers, so we add -an of_xlate() function to skip them according to the datasheet. - -Signed-off-by: Jens Kuske - ---- -.../bindings/reset/allwinner,sunxi-clock-reset.txt | 1 + - drivers/reset/reset-sunxi.c | 30 +++++++++++++++++++--- - 2 files changed, 28 insertions(+), 3 deletions(-) - -diff --git a/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt b/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt -index c8f7757..e11f023 100644 ---- a/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt -+++ b/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt -@@ -8,6 +8,7 @@ Required properties: - - compatible: Should be one of the following: - "allwinner,sun6i-a31-ahb1-reset" - "allwinner,sun6i-a31-clock-reset" -+ "allwinner,sun8i-h3-bus-reset" - - reg: should be register base and length as documented in the - datasheet - - #reset-cells: 1, see below -diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c -index 3d95c87..c91e146 100644 ---- a/drivers/reset/reset-sunxi.c -+++ b/drivers/reset/reset-sunxi.c -@@ -75,7 +75,9 @@ static struct reset_control_ops sunxi_reset_ops = { - .deassert = sunxi_reset_deassert, - }; - --static int sunxi_reset_init(struct device_node *np) -+static int sunxi_reset_init(struct device_node *np, -+ int (*of_xlate)(struct reset_controller_dev *rcdev, -+ const struct of_phandle_args *reset_spec)) - { - struct sunxi_reset_data *data; - struct resource res; -@@ -108,6 +110,7 @@ static int sunxi_reset_init(struct device_node *np) - data->rcdev.nr_resets = size * 32; - data->rcdev.ops = &sunxi_reset_ops; - data->rcdev.of_node = np; -+ data->rcdev.of_xlate = of_xlate; - reset_controller_register(&data->rcdev); - - return 0; -@@ -117,6 +120,21 @@ err_alloc: - return ret; - }; - -+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev, -+ const struct of_phandle_args *reset_spec) -+{ -+ unsigned int index = reset_spec->args[0]; -+ -+ if (index < 96) -+ return index; -+ else if (index < 128) -+ return index + 32; -+ else if (index < 160) -+ return index + 64; -+ else -+ return -EINVAL; -+} -+ - /* - * These are the reset controller we need to initialize early on in - * our system, before we can even think of using a regular device -@@ -124,15 +142,21 @@ err_alloc: - */ - static const struct of_device_id sunxi_early_reset_dt_ids[] __initdata = { - { .compatible = "allwinner,sun6i-a31-ahb1-reset", }, -+ { .compatible = "allwinner,sun8i-h3-bus-reset", .data = sun8i_h3_bus_reset_xlate, }, - { /* sentinel */ }, - }; - - void __init sun6i_reset_init(void) - { - struct device_node *np; -+ const struct of_device_id *match; -+ int (*of_xlate)(struct reset_controller_dev *rcdev, -+ const struct of_phandle_args *reset_spec); - -- for_each_matching_node(np, sunxi_early_reset_dt_ids) -- sunxi_reset_init(np); -+ for_each_matching_node_and_match(np, sunxi_early_reset_dt_ids, &match) { -+ of_xlate = match->data; -+ sunxi_reset_init(np, of_xlate); -+ } - } - - /* diff --git a/patch/kernel/h3-7498771.patch b/patch/kernel/h3-7498771.patch deleted file mode 100644 index cb7ec49c4..000000000 --- a/patch/kernel/h3-7498771.patch +++ /dev/null @@ -1,130 +0,0 @@ -From patchwork Tue Oct 27 16:50:26 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,6/6] ARM: dts: sun8i: Add Orange Pi Plus support -From: Jens Kuske -X-Patchwork-Id: 7498771 -Message-Id: <1445964626-6484-7-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Tue, 27 Oct 2015 17:50:26 +0100 - -The Orange Pi Plus is a SBC based on the Allwinner H3 SoC -with 8GB eMMC, multiple USB ports through a USB hub chip, SATA through -a USB-SATA bridge, one uSD slot, a 10/100/1000M ethernet port, -WiFi, HDMI, headphone jack, IR receiver, a microphone, a CSI connector -and a 40-pin GPIO header. - -Signed-off-by: Jens Kuske - ---- -arch/arm/boot/dts/Makefile | 3 +- - arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 77 ++++++++++++++++++++++++++++ - 2 files changed, 79 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts - -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 78ade1a..476658d 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -645,7 +645,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \ - sun8i-a33-ga10h-v1.1.dtb \ - sun8i-a33-ippo-q8h-v1.2.dtb \ - sun8i-a33-q8-tablet.dtb \ -- sun8i-a33-sinlinx-sina33.dtb -+ sun8i-a33-sinlinx-sina33.dtb \ -+ sun8i-h3-orangepi-plus.dtb - dtb-$(CONFIG_MACH_SUN9I) += \ - sun9i-a80-optimus.dtb \ - sun9i-a80-cubieboard4.dtb -diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts -new file mode 100644 -index 0000000..e67df59 ---- /dev/null -+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts -@@ -0,0 +1,77 @@ -+/* -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+#include "sun8i-h3.dtsi" -+#include "sunxi-common-regulators.dtsi" -+ -+#include -+#include -+ -+/ { -+ model = "Xunlong Orange Pi Plus"; -+ compatible = "xunlong,orangepi-plus", "allwinner,sun8i-h3"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; diff --git a/patch/kernel/h3-7498831.patch b/patch/kernel/h3-7498831.patch deleted file mode 100644 index 13d1e94cf..000000000 --- a/patch/kernel/h3-7498831.patch +++ /dev/null @@ -1,592 +0,0 @@ -From patchwork Tue Oct 27 16:50:23 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,3/6] pinctrl: sunxi: Add H3 PIO controller support -From: Jens Kuske -X-Patchwork-Id: 7498831 -Message-Id: <1445964626-6484-4-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Tue, 27 Oct 2015 17:50:23 +0100 - -The H3 uses the same pin controller as previous SoC's from Allwinner. -Add support for the pins controlled by the main PIO controller. - -Signed-off-by: Jens Kuske -Acked-by: Maxime Ripard - ---- -.../bindings/pinctrl/allwinner,sunxi-pinctrl.txt | 1 + - drivers/pinctrl/sunxi/Kconfig | 4 + - drivers/pinctrl/sunxi/Makefile | 1 + - drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c | 516 +++++++++++++++++++++ - 4 files changed, 522 insertions(+) - create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c - -diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt -index b321b26..e6ba602 100644 ---- a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt -@@ -18,6 +18,7 @@ Required properties: - "allwinner,sun8i-a23-r-pinctrl" - "allwinner,sun8i-a33-pinctrl" - "allwinner,sun8i-a83t-pinctrl" -+ "allwinner,sun8i-h3-pinctrl" - - - reg: Should contain the register physical address and length for the - pin controller. -diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig -index e68fd95..89ab7f5 100644 ---- a/drivers/pinctrl/sunxi/Kconfig -+++ b/drivers/pinctrl/sunxi/Kconfig -@@ -51,6 +51,10 @@ config PINCTRL_SUN8I_A23_R - depends on RESET_CONTROLLER - select PINCTRL_SUNXI_COMMON - -+config PINCTRL_SUN8I_H3 -+ def_bool MACH_SUN8I -+ select PINCTRL_SUNXI_COMMON -+ - config PINCTRL_SUN9I_A80 - def_bool MACH_SUN9I - select PINCTRL_SUNXI_COMMON -diff --git a/drivers/pinctrl/sunxi/Makefile b/drivers/pinctrl/sunxi/Makefile -index e080290..6bd818e 100644 ---- a/drivers/pinctrl/sunxi/Makefile -+++ b/drivers/pinctrl/sunxi/Makefile -@@ -13,4 +13,5 @@ obj-$(CONFIG_PINCTRL_SUN8I_A23) += pinctrl-sun8i-a23.o - obj-$(CONFIG_PINCTRL_SUN8I_A23_R) += pinctrl-sun8i-a23-r.o - obj-$(CONFIG_PINCTRL_SUN8I_A33) += pinctrl-sun8i-a33.o - obj-$(CONFIG_PINCTRL_SUN8I_A83T) += pinctrl-sun8i-a83t.o -+obj-$(CONFIG_PINCTRL_SUN8I_H3) += pinctrl-sun8i-h3.o - obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o -diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c -new file mode 100644 -index 0000000..98d465d ---- /dev/null -+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c -@@ -0,0 +1,516 @@ -+/* -+ * Allwinner H3 SoCs pinctrl driver. -+ * -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * Based on pinctrl-sun8i-a23.c, which is: -+ * Copyright (C) 2014 Chen-Yu Tsai -+ * Copyright (C) 2014 Maxime Ripard -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "pinctrl-sunxi.h" -+ -+static const struct sunxi_desc_pin sun8i_h3_pins[] = { -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* TX */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* MS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)), /* PA_EINT0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* RX */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* CK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)), /* PA_EINT1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* RTS */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* DO */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)), /* PA_EINT2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* DI */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)), /* PA_EINT3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart0"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)), /* PA_EINT4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart0"), /* RX */ -+ SUNXI_FUNCTION(0x3, "pwm0"), -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)), /* PA_EINT5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* PWREN */ -+ SUNXI_FUNCTION(0x3, "pwm1"), -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)), /* PA_EINT6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* CLK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)), /* PA_EINT7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* DATA */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)), /* PA_EINT8 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* RST */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)), /* PA_EINT9 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* DET */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)), /* PA_EINT10 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2c0"), /* SCK */ -+ SUNXI_FUNCTION(0x3, "di"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)), /* PA_EINT11 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2c0"), /* SDA */ -+ SUNXI_FUNCTION(0x3, "di"), /* RX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 12)), /* PA_EINT12 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* CS */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 13)), /* PA_EINT13 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* CLK */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* RX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 14)), /* PA_EINT14 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* RTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 15)), /* PA_EINT15 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 16), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* MISO */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* CTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 16)), /* PA_EINT16 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 17), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spdif"), /* OUT */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 17)), /* PA_EINT17 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 18), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* SYNC */ -+ SUNXI_FUNCTION(0x3, "i2c1"), /* SCK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 18)), /* PA_EINT18 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 19), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* CLK */ -+ SUNXI_FUNCTION(0x3, "i2c1"), /* SDA */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 19)), /* PA_EINT19 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 20), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* DOUT */ -+ SUNXI_FUNCTION(0x3, "sim"), /* VPPEN */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 20)), /* PA_EINT20 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 21), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* DIN */ -+ SUNXI_FUNCTION(0x3, "sim"), /* VPPPP */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 21)), /* PA_EINT21 */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* WE */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* ALE */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* MISO */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* CLE */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* CLK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* CS */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0")), /* CE0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* RE */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0")), /* RB1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand"), /* DQ6 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand"), /* DQ7 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand"), /* DQS */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* RST */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXCK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXCTL/RCDV */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXERR */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD2L */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* CRS */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXCK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXCTL/TXEN */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXERR */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* CLKIN/COL */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 16), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* MDC */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 17), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* MDIO */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* PCLK */ -+ SUNXI_FUNCTION(0x3, "ts")), /* CLK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* MCLK */ -+ SUNXI_FUNCTION(0x3, "ts")), /* ERR */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* HSYNC */ -+ SUNXI_FUNCTION(0x3, "ts")), /* SYNC */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* VSYNC */ -+ SUNXI_FUNCTION(0x3, "ts")), /* DVLD */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D0 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D1 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D2 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D3 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D4 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D5 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D6 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D7 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* SCK */ -+ SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* SDA */ -+ SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out")), -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out")), -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* MS */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* DI */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */ -+ SUNXI_FUNCTION(0x3, "uart0")), /* TX */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* DO */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */ -+ SUNXI_FUNCTION(0x3, "uart0")), /* RX */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* CK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0")), /* DET */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)), /* PG_EINT0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 1)), /* PG_EINT1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 2)), /* PG_EINT2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 3)), /* PG_EINT3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 4)), /* PG_EINT4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 5)), /* PG_EINT5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 6)), /* PG_EINT6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* RX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 7)), /* PG_EINT7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* RTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)), /* PG_EINT8 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* CTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)), /* PG_EINT9 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* SYNC */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 10)), /* PG_EINT10 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* CLK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 11)), /* PG_EINT11 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* DOUT */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 12)), /* PG_EINT12 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* DIN */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 13)), /* PG_EINT13 */ -+}; -+ -+static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = { -+ .pins = sun8i_h3_pins, -+ .npins = ARRAY_SIZE(sun8i_h3_pins), -+ .irq_banks = 2, -+}; -+ -+static int sun8i_h3_pinctrl_probe(struct platform_device *pdev) -+{ -+ return sunxi_pinctrl_init(pdev, -+ &sun8i_h3_pinctrl_data); -+} -+ -+static const struct of_device_id sun8i_h3_pinctrl_match[] = { -+ { .compatible = "allwinner,sun8i-h3-pinctrl", }, -+ {} -+}; -+ -+static struct platform_driver sun8i_h3_pinctrl_driver = { -+ .probe = sun8i_h3_pinctrl_probe, -+ .driver = { -+ .name = "sun8i-h3-pinctrl", -+ .of_match_table = sun8i_h3_pinctrl_match, -+ }, -+}; -+builtin_platform_driver(sun8i_h3_pinctrl_driver); diff --git a/patch/kernel/h3-7498891.patch b/patch/kernel/h3-7498891.patch deleted file mode 100644 index 0aef469e3..000000000 --- a/patch/kernel/h3-7498891.patch +++ /dev/null @@ -1,517 +0,0 @@ -From patchwork Tue Oct 27 16:50:25 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI -From: Jens Kuske -X-Patchwork-Id: 7498891 -Message-Id: <1445964626-6484-6-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Tue, 27 Oct 2015 17:50:25 +0100 - -The Allwinner H3 is a home entertainment system oriented SoC with -four Cortex-A7 cores and a Mali-400MP2 GPU. - -Signed-off-by: Jens Kuske - ---- -arch/arm/boot/dts/sun8i-h3.dtsi | 482 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 482 insertions(+) - create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi - -diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi -new file mode 100644 -index 0000000..c18b5f7 ---- /dev/null -+++ b/arch/arm/boot/dts/sun8i-h3.dtsi -@@ -0,0 +1,482 @@ -+/* -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+#include "skeleton.dtsi" -+ -+#include -+#include -+ -+/ { -+ interrupt-parent = <&gic>; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <0>; -+ }; -+ -+ cpu@1 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <1>; -+ }; -+ -+ cpu@2 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <2>; -+ }; -+ -+ cpu@3 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <3>; -+ }; -+ }; -+ -+ timer { -+ compatible = "arm,armv7-timer"; -+ interrupts = , -+ , -+ , -+ ; -+ clock-frequency = <24000000>; -+ arm,cpu-registers-not-fw-configured; -+ }; -+ -+ memory { -+ reg = <0x40000000 0x80000000>; -+ }; -+ -+ clocks { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ -+ osc24M: osc24M_clk { -+ #clock-cells = <0>; -+ compatible = "fixed-clock"; -+ clock-frequency = <24000000>; -+ clock-output-names = "osc24M"; -+ }; -+ -+ osc32k: osc32k_clk { -+ #clock-cells = <0>; -+ compatible = "fixed-clock"; -+ clock-frequency = <32768>; -+ clock-output-names = "osc32k"; -+ }; -+ -+ pll1: clk@01c20000 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun8i-a23-pll1-clk"; -+ reg = <0x01c20000 0x4>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll1"; -+ }; -+ -+ /* dummy clock until actually implemented */ -+ pll5: pll5_clk { -+ #clock-cells = <0>; -+ compatible = "fixed-clock"; -+ clock-frequency = <0>; -+ clock-output-names = "pll5"; -+ }; -+ -+ pll6: clk@01c20028 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun6i-a31-pll6-clk"; -+ reg = <0x01c20028 0x4>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll6", "pll6x2", "pll6d2"; -+ }; -+ -+ pll8: clk@01c20044 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun6i-a31-pll6-clk"; -+ reg = <0x01c20044 0x4>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll8", "pll8x2"; -+ }; -+ -+ cpu: cpu_clk@01c20050 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-cpu-clk"; -+ reg = <0x01c20050 0x4>; -+ clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>; -+ clock-output-names = "cpu"; -+ }; -+ -+ axi: axi_clk@01c20050 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-axi-clk"; -+ reg = <0x01c20050 0x4>; -+ clocks = <&cpu>; -+ clock-output-names = "axi"; -+ }; -+ -+ ahb1: ahb1_clk@01c20054 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun6i-a31-ahb1-clk"; -+ reg = <0x01c20054 0x4>; -+ clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>; -+ clock-output-names = "ahb1"; -+ }; -+ -+ ahb2: ahb2_clk@01c2005c { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun8i-h3-ahb2-clk"; -+ reg = <0x01c2005c 0x4>; -+ clocks = <&ahb1>, <&pll6 2>; -+ clock-output-names = "ahb2"; -+ }; -+ -+ apb1: apb1_clk@01c20054 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-apb0-clk"; -+ reg = <0x01c20054 0x4>; -+ clocks = <&ahb1>; -+ clock-output-names = "apb1"; -+ }; -+ -+ apb2: apb2_clk@01c20058 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-apb1-clk"; -+ reg = <0x01c20058 0x4>; -+ clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>; -+ clock-output-names = "apb2"; -+ }; -+ -+ bus_gates: clk@01c20060 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun8i-h3-bus-gates-clk"; -+ reg = <0x01c20060 0x14>; -+ clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>; -+ clock-names = "ahb1", "ahb2", "apb1", "apb2"; -+ clock-indices = <5>, <6>, <8>, -+ <9>, <10>, <13>, -+ <14>, <17>, <18>, -+ <19>, <20>, -+ <21>, <23>, -+ <24>, <25>, -+ <26>, <27>, -+ <28>, <29>, -+ <30>, <31>, <32>, -+ <35>, <36>, <37>, -+ <40>, <41>, <43>, -+ <44>, <52>, <53>, -+ <54>, <64>, -+ <65>, <69>, <72>, -+ <76>, <77>, <78>, -+ <96>, <97>, <98>, -+ <112>, <113>, -+ <114>, <115>, <116>, -+ <128>, <135>; -+ clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0", -+ "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", -+ "ahb1_sdram", "ahb2_gmac", "ahb1_ts", -+ "ahb1_hstimer", "ahb1_spi0", -+ "ahb1_spi1", "ahb1_otg", -+ "ahb1_otg_ehci0", "ahb1_ehic1", -+ "ahb1_ehic2", "ahb1_ehic3", -+ "ahb1_otg_ohci0", "ahb2_ohic1", -+ "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve", -+ "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint", -+ "ahb1_csi", "ahb1_tve", "ahb1_hdmi", -+ "ahb1_de", "ahb1_gpu", "ahb1_msgbox", -+ "ahb1_spinlock", "apb1_codec", -+ "apb1_spdif", "apb1_pio", "apb1_ths", -+ "apb1_i2s0", "apb1_i2s1", "apb1_i2s2", -+ "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", -+ "apb2_uart0", "apb2_uart1", -+ "apb2_uart2", "apb2_uart3", "apb2_scr", -+ "ahb1_ephy", "ahb1_dbg"; -+ }; -+ -+ mmc0_clk: clk@01c20088 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-mmc-clk"; -+ reg = <0x01c20088 0x4>; -+ clocks = <&osc24M>, <&pll6 0>, <&pll8 0>; -+ clock-output-names = "mmc0", -+ "mmc0_output", -+ "mmc0_sample"; -+ }; -+ -+ mmc1_clk: clk@01c2008c { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-mmc-clk"; -+ reg = <0x01c2008c 0x4>; -+ clocks = <&osc24M>, <&pll6 0>, <&pll8 0>; -+ clock-output-names = "mmc1", -+ "mmc1_output", -+ "mmc1_sample"; -+ }; -+ -+ mmc2_clk: clk@01c20090 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-mmc-clk"; -+ reg = <0x01c20090 0x4>; -+ clocks = <&osc24M>, <&pll6 0>, <&pll8 0>; -+ clock-output-names = "mmc2", -+ "mmc2_output", -+ "mmc2_sample"; -+ }; -+ -+ mbus_clk: clk@01c2015c { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun8i-a23-mbus-clk"; -+ reg = <0x01c2015c 0x4>; -+ clocks = <&osc24M>, <&pll6 1>, <&pll5>; -+ clock-output-names = "mbus"; -+ }; -+ }; -+ -+ soc { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ -+ dma: dma-controller@01c02000 { -+ compatible = "allwinner,sun8i-h3-dma"; -+ reg = <0x01c02000 0x1000>; -+ interrupts = ; -+ clocks = <&bus_gates 6>; -+ resets = <&bus_rst 6>; -+ #dma-cells = <1>; -+ }; -+ -+ mmc0: mmc@01c0f000 { -+ compatible = "allwinner,sun5i-a13-mmc"; -+ reg = <0x01c0f000 0x1000>; -+ clocks = <&bus_gates 8>, -+ <&mmc0_clk 0>, -+ <&mmc0_clk 1>, -+ <&mmc0_clk 2>; -+ clock-names = "ahb", -+ "mmc", -+ "output", -+ "sample"; -+ resets = <&bus_rst 8>; -+ reset-names = "ahb"; -+ interrupts = ; -+ status = "disabled"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ mmc1: mmc@01c10000 { -+ compatible = "allwinner,sun5i-a13-mmc"; -+ reg = <0x01c10000 0x1000>; -+ clocks = <&bus_gates 9>, -+ <&mmc1_clk 0>, -+ <&mmc1_clk 1>, -+ <&mmc1_clk 2>; -+ clock-names = "ahb", -+ "mmc", -+ "output", -+ "sample"; -+ resets = <&bus_rst 9>; -+ reset-names = "ahb"; -+ interrupts = ; -+ status = "disabled"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ mmc2: mmc@01c11000 { -+ compatible = "allwinner,sun5i-a13-mmc"; -+ reg = <0x01c11000 0x1000>; -+ clocks = <&bus_gates 10>, -+ <&mmc2_clk 0>, -+ <&mmc2_clk 1>, -+ <&mmc2_clk 2>; -+ clock-names = "ahb", -+ "mmc", -+ "output", -+ "sample"; -+ resets = <&bus_rst 10>; -+ reset-names = "ahb"; -+ interrupts = ; -+ status = "disabled"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ pio: pinctrl@01c20800 { -+ compatible = "allwinner,sun8i-h3-pinctrl"; -+ reg = <0x01c20800 0x400>; -+ interrupts = , -+ ; -+ clocks = <&bus_gates 69>; -+ gpio-controller; -+ #gpio-cells = <3>; -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ -+ uart0_pins_a: uart0@0 { -+ allwinner,pins = "PA4", "PA5"; -+ allwinner,function = "uart0"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc0_pins_a: mmc0@0 { -+ allwinner,pins = "PF0", "PF1", "PF2", "PF3", -+ "PF4", "PF5"; -+ allwinner,function = "mmc0"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc0_cd_pin: mmc0_cd_pin@0 { -+ allwinner,pins = "PF6"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc1_pins_a: mmc1@0 { -+ allwinner,pins = "PG0", "PG1", "PG2", "PG3", -+ "PG4", "PG5"; -+ allwinner,function = "mmc1"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ }; -+ -+ bus_rst: reset@01c202c0 { -+ #reset-cells = <1>; -+ compatible = "allwinner,sun8i-h3-bus-reset"; -+ reg = <0x01c202c0 0x1c>; -+ }; -+ -+ timer@01c20c00 { -+ compatible = "allwinner,sun4i-a10-timer"; -+ reg = <0x01c20c00 0xa0>; -+ interrupts = , -+ ; -+ clocks = <&osc24M>; -+ }; -+ -+ wdt0: watchdog@01c20ca0 { -+ compatible = "allwinner,sun6i-a31-wdt"; -+ reg = <0x01c20ca0 0x20>; -+ interrupts = ; -+ }; -+ -+ uart0: serial@01c28000 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28000 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 112>; -+ resets = <&bus_rst 144>; -+ dmas = <&dma 6>, <&dma 6>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ uart1: serial@01c28400 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28400 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 113>; -+ resets = <&bus_rst 145>; -+ dmas = <&dma 7>, <&dma 7>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ uart2: serial@01c28800 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28800 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 114>; -+ resets = <&bus_rst 146>; -+ dmas = <&dma 8>, <&dma 8>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ uart3: serial@01c28c00 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28c00 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 115>; -+ resets = <&bus_rst 147>; -+ dmas = <&dma 9>, <&dma 9>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ gic: interrupt-controller@01c81000 { -+ compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic"; -+ reg = <0x01c81000 0x1000>, -+ <0x01c82000 0x1000>, -+ <0x01c84000 0x2000>, -+ <0x01c86000 0x2000>; -+ interrupt-controller; -+ #interrupt-cells = <3>; -+ interrupts = ; -+ }; -+ -+ rtc: rtc@01f00000 { -+ compatible = "allwinner,sun6i-a31-rtc"; -+ reg = <0x01f00000 0x54>; -+ interrupts = , -+ ; -+ }; -+ }; -+}; diff --git a/patch/kernel/neo-patch-3.14.35-36 b/patch/kernel/neo-patch-3.14.35-36 deleted file mode 100644 index 261ccc851..000000000 --- a/patch/kernel/neo-patch-3.14.35-36 +++ /dev/null @@ -1,3448 +0,0 @@ -diff --git a/Makefile b/Makefile -index 9720e863c06f..4e6537bd8aa0 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 35 -+SUBLEVEL = 36 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h -index 15334ab66b56..fb95aa807215 100644 ---- a/arch/arc/include/asm/processor.h -+++ b/arch/arc/include/asm/processor.h -@@ -69,18 +69,19 @@ unsigned long thread_saved_pc(struct task_struct *t); - #define release_segments(mm) do { } while (0) - - #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ret) -+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) - - /* - * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. - * Look in process.c for details of kernel stack layout - */ --#define KSTK_ESP(tsk) (tsk->thread.ksp) -+#define TSK_K_ESP(tsk) (tsk->thread.ksp) - --#define KSTK_REG(tsk, off) (*((unsigned int *)(KSTK_ESP(tsk) + \ -+#define TSK_K_REG(tsk, off) (*((unsigned int *)(TSK_K_ESP(tsk) + \ - sizeof(struct callee_regs) + off))) - --#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4) --#define KSTK_FP(tsk) KSTK_REG(tsk, 0) -+#define TSK_K_BLINK(tsk) TSK_K_REG(tsk, 4) -+#define TSK_K_FP(tsk) TSK_K_REG(tsk, 0) - - /* - * Do necessary setup to start up a newly executed thread. -diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c -index 9ce47cfe2303..fb98769b6a98 100644 ---- a/arch/arc/kernel/stacktrace.c -+++ b/arch/arc/kernel/stacktrace.c -@@ -64,9 +64,9 @@ static void seed_unwind_frame_info(struct task_struct *tsk, - - frame_info->task = tsk; - -- frame_info->regs.r27 = KSTK_FP(tsk); -- frame_info->regs.r28 = KSTK_ESP(tsk); -- frame_info->regs.r31 = KSTK_BLINK(tsk); -+ frame_info->regs.r27 = TSK_K_FP(tsk); -+ frame_info->regs.r28 = TSK_K_ESP(tsk); -+ frame_info->regs.r31 = TSK_K_BLINK(tsk); - frame_info->regs.r63 = (unsigned int)__switch_to; - - /* In the prologue of __switch_to, first FP is saved on stack -diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h -index bc9e0f406c08..e51621e36152 100644 ---- a/arch/mips/kvm/trace.h -+++ b/arch/mips/kvm/trace.h -@@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit, - TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), - TP_ARGS(vcpu, reason), - TP_STRUCT__entry( -- __field(struct kvm_vcpu *, vcpu) -+ __field(unsigned long, pc) - __field(unsigned int, reason) - ), - - TP_fast_assign( -- __entry->vcpu = vcpu; -+ __entry->pc = vcpu->arch.pc; - __entry->reason = reason; - ), - - TP_printk("[%s]PC: 0x%08lx", - kvm_mips_exit_types_str[__entry->reason], -- __entry->vcpu->arch.pc) -+ __entry->pc) - ); - - #endif /* _TRACE_KVM_H */ -diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 02553d6d183d..06469ee0f26e 100644 ---- a/arch/x86/kernel/entry_64.S -+++ b/arch/x86/kernel/entry_64.S -@@ -542,11 +542,14 @@ ENTRY(ret_from_fork) - testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? - jz 1f - -- testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -- jnz int_ret_from_sys_call -- -- RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET -- jmp ret_from_sys_call # go to the SYSRET fastpath -+ /* -+ * By the time we get here, we have no idea whether our pt_regs, -+ * ti flags, and ti status came from the 64-bit SYSCALL fast path, -+ * the slow path, or one of the ia32entry paths. -+ * Use int_ret_from_sys_call to return, since it can safely handle -+ * all of the above. -+ */ -+ jmp int_ret_from_sys_call - - 1: - subq $REST_SKIP, %rsp # leave space for volatiles -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 38d3751472e4..09651d4a9038 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -4646,7 +4646,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) - if (rc != X86EMUL_CONTINUE) - goto done; - } -- ctxt->dst.orig_val = ctxt->dst.val; -+ /* Copy full 64-bit value for CMPXCHG8B. */ -+ ctxt->dst.orig_val64 = ctxt->dst.val64; - - special_insn: - -diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c -index bb0b90461a6b..997540dc8250 100644 ---- a/drivers/acpi/video.c -+++ b/drivers/acpi/video.c -@@ -2064,6 +2064,17 @@ EXPORT_SYMBOL(acpi_video_unregister); - - static int __init acpi_video_init(void) - { -+ /* -+ * Let the module load even if ACPI is disabled (e.g. due to -+ * a broken BIOS) so that i915.ko can still be loaded on such -+ * old systems without an AcpiOpRegion. -+ * -+ * acpi_video_register() will report -ENODEV later as well due -+ * to acpi_disabled when i915.ko tries to register itself afterwards. -+ */ -+ if (acpi_disabled) -+ return 0; -+ - dmi_check_system(video_dmi_table); - - if (intel_opregion_present()) -diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c -index 4a58c55255bd..797bab97cea6 100644 ---- a/drivers/clk/clk-gate.c -+++ b/drivers/clk/clk-gate.c -@@ -128,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name, - struct clk_init_data init; - - if (clk_gate_flags & CLK_GATE_HIWORD_MASK) { -- if (bit_idx > 16) { -+ if (bit_idx > 15) { - pr_err("gate bit exceeds LOWORD field\n"); - return ERR_PTR(-EINVAL); - } -diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c -index 9e232644f07e..ea4db844aee3 100644 ---- a/drivers/clk/sunxi/clk-factors.c -+++ b/drivers/clk/sunxi/clk-factors.c -@@ -62,7 +62,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, - p = FACTOR_GET(config->pshift, config->pwidth, reg); - - /* Calculate the rate */ -- rate = (parent_rate * n * (k + 1) >> p) / (m + 1); -+ rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1); - - return rate; - } -diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h -index 02e1a43ebac7..d2d0efa39379 100644 ---- a/drivers/clk/sunxi/clk-factors.h -+++ b/drivers/clk/sunxi/clk-factors.h -@@ -15,6 +15,7 @@ struct clk_factors_config { - u8 mwidth; - u8 pshift; - u8 pwidth; -+ u8 n_start; - }; - - struct clk_factors { -diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c -index abb6c5ac8a10..06a14b808683 100644 ---- a/drivers/clk/sunxi/clk-sunxi.c -+++ b/drivers/clk/sunxi/clk-sunxi.c -@@ -407,6 +407,7 @@ static struct clk_factors_config sun6i_a31_pll1_config = { - .kwidth = 2, - .mshift = 0, - .mwidth = 2, -+ .n_start = 1, - }; - - static struct clk_factors_config sun4i_pll5_config = { -diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c -index 09dd0173ea0a..5f52f3f62644 100644 ---- a/drivers/clk/zynq/clkc.c -+++ b/drivers/clk/zynq/clkc.c -@@ -300,6 +300,7 @@ static void __init zynq_clk_setup(struct device_node *np) - clks[cpu_2x] = clk_register_gate(NULL, clk_output_name[cpu_2x], - "cpu_2x_div", CLK_IGNORE_UNUSED, SLCR_ARM_CLK_CTRL, - 26, 0, &armclk_lock); -+ clk_prepare_enable(clks[cpu_2x]); - - clk = clk_register_fixed_factor(NULL, "cpu_1x_div", "cpu_div", 0, 1, - 4 + 2 * tmp); -diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c -index 97cdd16a2169..c98b101a73ae 100644 ---- a/drivers/firmware/efi/runtime-map.c -+++ b/drivers/firmware/efi/runtime-map.c -@@ -170,7 +170,7 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj) - - return 0; - out_add_entry: -- for (j = i - 1; j > 0; j--) { -+ for (j = i - 1; j >= 0; j--) { - entry = *(map_entries + j); - kobject_put(&entry->kobj); - } -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index 8ef67cb4ef1e..f0ed0baddf70 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -3558,7 +3558,21 @@ void cik_fence_gfx_ring_emit(struct radeon_device *rdev, - struct radeon_ring *ring = &rdev->ring[fence->ring]; - u64 addr = rdev->fence_drv[fence->ring].gpu_addr; - -- /* EVENT_WRITE_EOP - flush caches, send int */ -+ /* Workaround for cache flush problems. First send a dummy EOP -+ * event down the pipe with seq one below. -+ */ -+ radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); -+ radeon_ring_write(ring, (EOP_TCL1_ACTION_EN | -+ EOP_TC_ACTION_EN | -+ EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) | -+ EVENT_INDEX(5))); -+ radeon_ring_write(ring, addr & 0xfffffffc); -+ radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) | -+ DATA_SEL(1) | INT_SEL(0)); -+ radeon_ring_write(ring, fence->seq - 1); -+ radeon_ring_write(ring, 0); -+ -+ /* Then send the real EOP event down the pipe. */ - radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); - radeon_ring_write(ring, (EOP_TCL1_ACTION_EN | - EOP_TC_ACTION_EN | -@@ -6809,7 +6823,6 @@ int cik_irq_set(struct radeon_device *rdev) - u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; - u32 grbm_int_cntl = 0; - u32 dma_cntl, dma_cntl1; -- u32 thermal_int; - - if (!rdev->irq.installed) { - WARN(1, "Can't enable IRQ/MSI because no handler is installed\n"); -@@ -6846,13 +6859,6 @@ int cik_irq_set(struct radeon_device *rdev) - cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; - cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; - -- if (rdev->flags & RADEON_IS_IGP) -- thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL) & -- ~(THERM_INTH_MASK | THERM_INTL_MASK); -- else -- thermal_int = RREG32_SMC(CG_THERMAL_INT) & -- ~(THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW); -- - /* enable CP interrupts on all rings */ - if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) { - DRM_DEBUG("cik_irq_set: sw int gfx\n"); -@@ -7010,14 +7016,6 @@ int cik_irq_set(struct radeon_device *rdev) - hpd6 |= DC_HPDx_INT_EN; - } - -- if (rdev->irq.dpm_thermal) { -- DRM_DEBUG("dpm thermal\n"); -- if (rdev->flags & RADEON_IS_IGP) -- thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK; -- else -- thermal_int |= THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW; -- } -- - WREG32(CP_INT_CNTL_RING0, cp_int_cntl); - - WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, dma_cntl); -@@ -7071,11 +7069,6 @@ int cik_irq_set(struct radeon_device *rdev) - WREG32(DC_HPD5_INT_CONTROL, hpd5); - WREG32(DC_HPD6_INT_CONTROL, hpd6); - -- if (rdev->flags & RADEON_IS_IGP) -- WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int); -- else -- WREG32_SMC(CG_THERMAL_INT, thermal_int); -- - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c -index 351db361239d..c7c7bc5d573f 100644 ---- a/drivers/gpu/drm/radeon/kv_dpm.c -+++ b/drivers/gpu/drm/radeon/kv_dpm.c -@@ -1121,6 +1121,19 @@ void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable) - } - } - -+static void kv_enable_thermal_int(struct radeon_device *rdev, bool enable) -+{ -+ u32 thermal_int; -+ -+ thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL); -+ if (enable) -+ thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK; -+ else -+ thermal_int &= ~(THERM_INTH_MASK | THERM_INTL_MASK); -+ WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int); -+ -+} -+ - int kv_dpm_enable(struct radeon_device *rdev) - { - struct kv_power_info *pi = kv_get_pi(rdev); -@@ -1232,8 +1245,7 @@ int kv_dpm_late_enable(struct radeon_device *rdev) - DRM_ERROR("kv_set_thermal_temperature_range failed\n"); - return ret; - } -- rdev->irq.dpm_thermal = true; -- radeon_irq_set(rdev); -+ kv_enable_thermal_int(rdev, true); - } - - /* powerdown unused blocks for now */ -@@ -1261,6 +1273,7 @@ void kv_dpm_disable(struct radeon_device *rdev) - kv_stop_dpm(rdev); - kv_enable_ulv(rdev, false); - kv_reset_am(rdev); -+ kv_enable_thermal_int(rdev, false); - - kv_update_current_ps(rdev, rdev->pm.dpm.boot_ps); - } -diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c -index bf6300cfd62d..f8c01b8d1594 100644 ---- a/drivers/gpu/drm/radeon/ni.c -+++ b/drivers/gpu/drm/radeon/ni.c -@@ -1073,12 +1073,12 @@ static void cayman_gpu_init(struct radeon_device *rdev) - - if ((rdev->config.cayman.max_backends_per_se == 1) && - (rdev->flags & RADEON_IS_IGP)) { -- if ((disabled_rb_mask & 3) == 1) { -- /* RB0 disabled, RB1 enabled */ -- tmp = 0x11111111; -- } else { -+ if ((disabled_rb_mask & 3) == 2) { - /* RB1 disabled, RB0 enabled */ - tmp = 0x00000000; -+ } else { -+ /* RB0 disabled, RB1 enabled */ -+ tmp = 0x11111111; - } - } else { - tmp = gb_addr_config & NUM_PIPES_MASK; -diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c -index 3334f916945b..e98108236e04 100644 ---- a/drivers/gpu/drm/radeon/r600_dpm.c -+++ b/drivers/gpu/drm/radeon/r600_dpm.c -@@ -187,7 +187,7 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev) - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - radeon_crtc = to_radeon_crtc(crtc); - if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { -- vrefresh = radeon_crtc->hw_mode.vrefresh; -+ vrefresh = drm_mode_vrefresh(&radeon_crtc->hw_mode); - break; - } - } -diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c -index e2de749327ad..2fa3cf615a67 100644 ---- a/drivers/gpu/drm/radeon/radeon_atombios.c -+++ b/drivers/gpu/drm/radeon/radeon_atombios.c -@@ -3272,6 +3272,7 @@ int radeon_atom_get_voltage_evv(struct radeon_device *rdev, - - args.in.ucVoltageType = VOLTAGE_TYPE_VDDC; - args.in.ucVoltageMode = ATOM_GET_VOLTAGE_EVV_VOLTAGE; -+ args.in.usVoltageLevel = cpu_to_le16(virtual_voltage_id); - args.in.ulSCLKFreq = - cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk); - -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index 4b87bb164f30..a413f76e84d4 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -1066,6 +1066,23 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct - return; - } - -+ /* -+ * Ignore reports for absolute data if the data didn't change. This is -+ * not only an optimization but also fixes 'dead' key reports. Some -+ * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID -+ * 0x31 and 0x32) report multiple keys, even though a localized keyboard -+ * can only have one of them physically available. The 'dead' keys -+ * report constant 0. As all map to the same keycode, they'd confuse -+ * the input layer. If we filter the 'dead' keys on the HID level, we -+ * skip the keycode translation and only forward real events. -+ */ -+ if (!(field->flags & (HID_MAIN_ITEM_RELATIVE | -+ HID_MAIN_ITEM_BUFFERED_BYTE)) && -+ (field->flags & HID_MAIN_ITEM_VARIABLE) && -+ usage->usage_index < field->maxusage && -+ value == field->value[usage->usage_index]) -+ return; -+ - /* report the usage code as scancode if the key status has changed */ - if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) - input_event(input, EV_MSC, MSC_SCAN, usage->hid); -diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c -index 47dcb34ff44c..3a615f3b5d80 100644 ---- a/drivers/iio/adc/mcp3422.c -+++ b/drivers/iio/adc/mcp3422.c -@@ -57,20 +57,11 @@ - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ - } - --/* LSB is in nV to eliminate floating point */ --static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625}; -- --/* -- * scales calculated as: -- * rates_to_lsb[sample_rate] / (1 << pga); -- * pga is 1 for 0, 2 -- */ -- - static const int mcp3422_scales[4][4] = { -- { 1000000, 250000, 62500, 15625 }, -- { 500000 , 125000, 31250, 7812 }, -- { 250000 , 62500 , 15625, 3906 }, -- { 125000 , 31250 , 7812 , 1953 } }; -+ { 1000000, 500000, 250000, 125000 }, -+ { 250000 , 125000, 62500 , 31250 }, -+ { 62500 , 31250 , 15625 , 7812 }, -+ { 15625 , 7812 , 3906 , 1953 } }; - - /* Constant msleep times for data acquisitions */ - static const int mcp3422_read_times[4] = { -diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c -index 17aca4d9bd06..861ba3d60163 100644 ---- a/drivers/iio/dac/ad5686.c -+++ b/drivers/iio/dac/ad5686.c -@@ -322,7 +322,7 @@ static int ad5686_probe(struct spi_device *spi) - st = iio_priv(indio_dev); - spi_set_drvdata(spi, indio_dev); - -- st->reg = devm_regulator_get(&spi->dev, "vcc"); -+ st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) -diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c -index 7c582f7ae34e..70753bf23a86 100644 ---- a/drivers/iio/imu/adis16400_core.c -+++ b/drivers/iio/imu/adis16400_core.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -447,7 +448,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, - mutex_unlock(&indio_dev->mlock); - if (ret) - return ret; -- val16 = ((val16 & 0xFFF) << 4) >> 4; -+ val16 = sign_extend32(val16, 11); - *val = val16; - return IIO_VAL_INT; - case IIO_CHAN_INFO_OFFSET: -diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c -index 56a4b7ca7ee3..45d67e9228d7 100644 ---- a/drivers/infiniband/core/ucma.c -+++ b/drivers/infiniband/core/ucma.c -@@ -1124,6 +1124,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx, - if (!optlen) - return -EINVAL; - -+ memset(&sa_path, 0, sizeof(sa_path)); -+ sa_path.vlan_id = 0xffff; -+ - ib_sa_unpack_path(path_data->path_rec, &sa_path); - ret = rdma_set_ib_paths(ctx->cm_id, &sa_path, 1); - if (ret) -diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c -index 23467a2abd62..2adc14372b94 100644 ---- a/drivers/infiniband/core/uverbs_cmd.c -+++ b/drivers/infiniband/core/uverbs_cmd.c -@@ -1964,20 +1964,21 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, - if (qp->real_qp == qp) { - ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask); - if (ret) -- goto out; -+ goto release_qp; - ret = qp->device->modify_qp(qp, attr, - modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata); - } else { - ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, cmd.attr_mask)); - } - -- put_qp_read(qp); -- - if (ret) -- goto out; -+ goto release_qp; - - ret = in_len; - -+release_qp: -+ put_qp_read(qp); -+ - out: - kfree(attr); - -diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c -index 11f0606792bb..1a3d924744cc 100644 ---- a/drivers/infiniband/hw/mlx4/main.c -+++ b/drivers/infiniband/hw/mlx4/main.c -@@ -1161,8 +1161,7 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - struct mlx4_ib_qp *mqp = to_mqp(ibqp); - u64 reg_id; - struct mlx4_ib_steering *ib_steering = NULL; -- enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? -- MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; -+ enum mlx4_protocol prot = MLX4_PROT_IB_IPV6; - - if (mdev->dev->caps.steering_mode == - MLX4_STEERING_MODE_DEVICE_MANAGED) { -@@ -1175,8 +1174,10 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - !!(mqp->flags & - MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK), - prot, ®_id); -- if (err) -+ if (err) { -+ pr_err("multicast attach op failed, err %d\n", err); - goto err_malloc; -+ } - - err = add_gid_entry(ibqp, gid); - if (err) -@@ -1224,8 +1225,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - struct net_device *ndev; - struct mlx4_ib_gid_entry *ge; - u64 reg_id = 0; -- enum mlx4_protocol prot = (gid->raw[1] == 0x0e) ? -- MLX4_PROT_IB_IPV4 : MLX4_PROT_IB_IPV6; -+ enum mlx4_protocol prot = MLX4_PROT_IB_IPV6; - - if (mdev->dev->caps.steering_mode == - MLX4_STEERING_MODE_DEVICE_MANAGED) { -diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h -index 1946101419a3..675d3c796b9f 100644 ---- a/drivers/infiniband/hw/qib/qib.h -+++ b/drivers/infiniband/hw/qib/qib.h -@@ -1080,12 +1080,6 @@ struct qib_devdata { - /* control high-level access to EEPROM */ - struct mutex eep_lock; - uint64_t traffic_wds; -- /* active time is kept in seconds, but logged in hours */ -- atomic_t active_time; -- /* Below are nominal shadow of EEPROM, new since last EEPROM update */ -- uint8_t eep_st_errs[QIB_EEP_LOG_CNT]; -- uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT]; -- uint16_t eep_hrs; - /* - * masks for which bits of errs, hwerrs that cause - * each of the counters to increment. -@@ -1307,8 +1301,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer, - int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr, - const void *buffer, int len); - void qib_get_eeprom_info(struct qib_devdata *); --int qib_update_eeprom_log(struct qib_devdata *dd); --void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr); -+#define qib_inc_eeprom_err(dd, eidx, incr) - void qib_dump_lookup_output_queue(struct qib_devdata *); - void qib_force_pio_avail_update(struct qib_devdata *); - void qib_clear_symerror_on_linkup(unsigned long opaque); -diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c -index 4d5d71aaa2b4..e2280b07df02 100644 ---- a/drivers/infiniband/hw/qib/qib_eeprom.c -+++ b/drivers/infiniband/hw/qib/qib_eeprom.c -@@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd) - "Board SN %s did not pass functional test: %s\n", - dd->serial, ifp->if_comment); - -- memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT); -- /* -- * Power-on (actually "active") hours are kept as little-endian value -- * in EEPROM, but as seconds in a (possibly as small as 24-bit) -- * atomic_t while running. -- */ -- atomic_set(&dd->active_time, 0); -- dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8); -- - done: - vfree(buf); - - bail:; - } - --/** -- * qib_update_eeprom_log - copy active-time and error counters to eeprom -- * @dd: the qlogic_ib device -- * -- * Although the time is kept as seconds in the qib_devdata struct, it is -- * rounded to hours for re-write, as we have only 16 bits in EEPROM. -- * First-cut code reads whole (expected) struct qib_flash, modifies, -- * re-writes. Future direction: read/write only what we need, assuming -- * that the EEPROM had to have been "good enough" for driver init, and -- * if not, we aren't making it worse. -- * -- */ --int qib_update_eeprom_log(struct qib_devdata *dd) --{ -- void *buf; -- struct qib_flash *ifp; -- int len, hi_water; -- uint32_t new_time, new_hrs; -- u8 csum; -- int ret, idx; -- unsigned long flags; -- -- /* first, check if we actually need to do anything. */ -- ret = 0; -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- if (dd->eep_st_new_errs[idx]) { -- ret = 1; -- break; -- } -- } -- new_time = atomic_read(&dd->active_time); -- -- if (ret == 0 && new_time < 3600) -- goto bail; -- -- /* -- * The quick-check above determined that there is something worthy -- * of logging, so get current contents and do a more detailed idea. -- * read full flash, not just currently used part, since it may have -- * been written with a newer definition -- */ -- len = sizeof(struct qib_flash); -- buf = vmalloc(len); -- ret = 1; -- if (!buf) { -- qib_dev_err(dd, -- "Couldn't allocate memory to read %u bytes from eeprom for logging\n", -- len); -- goto bail; -- } -- -- /* Grab semaphore and read current EEPROM. If we get an -- * error, let go, but if not, keep it until we finish write. -- */ -- ret = mutex_lock_interruptible(&dd->eep_lock); -- if (ret) { -- qib_dev_err(dd, "Unable to acquire EEPROM for logging\n"); -- goto free_bail; -- } -- ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len); -- if (ret) { -- mutex_unlock(&dd->eep_lock); -- qib_dev_err(dd, "Unable read EEPROM for logging\n"); -- goto free_bail; -- } -- ifp = (struct qib_flash *)buf; -- -- csum = flash_csum(ifp, 0); -- if (csum != ifp->if_csum) { -- mutex_unlock(&dd->eep_lock); -- qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n", -- csum, ifp->if_csum); -- ret = 1; -- goto free_bail; -- } -- hi_water = 0; -- spin_lock_irqsave(&dd->eep_st_lock, flags); -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- int new_val = dd->eep_st_new_errs[idx]; -- if (new_val) { -- /* -- * If we have seen any errors, add to EEPROM values -- * We need to saturate at 0xFF (255) and we also -- * would need to adjust the checksum if we were -- * trying to minimize EEPROM traffic -- * Note that we add to actual current count in EEPROM, -- * in case it was altered while we were running. -- */ -- new_val += ifp->if_errcntp[idx]; -- if (new_val > 0xFF) -- new_val = 0xFF; -- if (ifp->if_errcntp[idx] != new_val) { -- ifp->if_errcntp[idx] = new_val; -- hi_water = offsetof(struct qib_flash, -- if_errcntp) + idx; -- } -- /* -- * update our shadow (used to minimize EEPROM -- * traffic), to match what we are about to write. -- */ -- dd->eep_st_errs[idx] = new_val; -- dd->eep_st_new_errs[idx] = 0; -- } -- } -- /* -- * Now update active-time. We would like to round to the nearest hour -- * but unless atomic_t are sure to be proper signed ints we cannot, -- * because we need to account for what we "transfer" to EEPROM and -- * if we log an hour at 31 minutes, then we would need to set -- * active_time to -29 to accurately count the _next_ hour. -- */ -- if (new_time >= 3600) { -- new_hrs = new_time / 3600; -- atomic_sub((new_hrs * 3600), &dd->active_time); -- new_hrs += dd->eep_hrs; -- if (new_hrs > 0xFFFF) -- new_hrs = 0xFFFF; -- dd->eep_hrs = new_hrs; -- if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) { -- ifp->if_powerhour[0] = new_hrs & 0xFF; -- hi_water = offsetof(struct qib_flash, if_powerhour); -- } -- if ((new_hrs >> 8) != ifp->if_powerhour[1]) { -- ifp->if_powerhour[1] = new_hrs >> 8; -- hi_water = offsetof(struct qib_flash, if_powerhour) + 1; -- } -- } -- /* -- * There is a tiny possibility that we could somehow fail to write -- * the EEPROM after updating our shadows, but problems from holding -- * the spinlock too long are a much bigger issue. -- */ -- spin_unlock_irqrestore(&dd->eep_st_lock, flags); -- if (hi_water) { -- /* we made some change to the data, uopdate cksum and write */ -- csum = flash_csum(ifp, 1); -- ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1); -- } -- mutex_unlock(&dd->eep_lock); -- if (ret) -- qib_dev_err(dd, "Failed updating EEPROM\n"); -- --free_bail: -- vfree(buf); --bail: -- return ret; --} -- --/** -- * qib_inc_eeprom_err - increment one of the four error counters -- * that are logged to EEPROM. -- * @dd: the qlogic_ib device -- * @eidx: 0..3, the counter to increment -- * @incr: how much to add -- * -- * Each counter is 8-bits, and saturates at 255 (0xFF). They -- * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log() -- * is called, but it can only be called in a context that allows sleep. -- * This function can be called even at interrupt level. -- */ --void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr) --{ -- uint new_val; -- unsigned long flags; -- -- spin_lock_irqsave(&dd->eep_st_lock, flags); -- new_val = dd->eep_st_new_errs[eidx] + incr; -- if (new_val > 255) -- new_val = 255; -- dd->eep_st_new_errs[eidx] = new_val; -- spin_unlock_irqrestore(&dd->eep_st_lock, flags); --} -diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c -index 84e593d6007b..295f6312e6a9 100644 ---- a/drivers/infiniband/hw/qib/qib_iba6120.c -+++ b/drivers/infiniband/hw/qib/qib_iba6120.c -@@ -2682,8 +2682,6 @@ static void qib_get_6120_faststats(unsigned long opaque) - spin_lock_irqsave(&dd->eep_st_lock, flags); - traffic_wds -= dd->traffic_wds; - dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(5, &dd->active_time); /* S/B #define */ - spin_unlock_irqrestore(&dd->eep_st_lock, flags); - - qib_chk_6120_errormask(dd); -diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c -index 454c2e7668fe..c86e71b9e160 100644 ---- a/drivers/infiniband/hw/qib/qib_iba7220.c -+++ b/drivers/infiniband/hw/qib/qib_iba7220.c -@@ -3299,8 +3299,6 @@ static void qib_get_7220_faststats(unsigned long opaque) - spin_lock_irqsave(&dd->eep_st_lock, flags); - traffic_wds -= dd->traffic_wds; - dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(5, &dd->active_time); /* S/B #define */ - spin_unlock_irqrestore(&dd->eep_st_lock, flags); - done: - mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER); -diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c -index d1bd21319d7d..0f8d1f0bd929 100644 ---- a/drivers/infiniband/hw/qib/qib_iba7322.c -+++ b/drivers/infiniband/hw/qib/qib_iba7322.c -@@ -5191,8 +5191,6 @@ static void qib_get_7322_faststats(unsigned long opaque) - spin_lock_irqsave(&ppd->dd->eep_st_lock, flags); - traffic_wds -= ppd->dd->traffic_wds; - ppd->dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time); - spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags); - if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & - QIB_IB_QDR) && -diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c -index 76c3e177164d..8c9bb6c35838 100644 ---- a/drivers/infiniband/hw/qib/qib_init.c -+++ b/drivers/infiniband/hw/qib/qib_init.c -@@ -922,7 +922,6 @@ static void qib_shutdown_device(struct qib_devdata *dd) - } - } - -- qib_update_eeprom_log(dd); - } - - /** -diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c -index 3c8e4e3caca6..b9ccbda7817d 100644 ---- a/drivers/infiniband/hw/qib/qib_sysfs.c -+++ b/drivers/infiniband/hw/qib/qib_sysfs.c -@@ -611,28 +611,6 @@ bail: - return ret < 0 ? ret : count; - } - --static ssize_t show_logged_errs(struct device *device, -- struct device_attribute *attr, char *buf) --{ -- struct qib_ibdev *dev = -- container_of(device, struct qib_ibdev, ibdev.dev); -- struct qib_devdata *dd = dd_from_dev(dev); -- int idx, count; -- -- /* force consistency with actual EEPROM */ -- if (qib_update_eeprom_log(dd) != 0) -- return -ENXIO; -- -- count = 0; -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c", -- dd->eep_st_errs[idx], -- idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' '); -- } -- -- return count; --} -- - /* - * Dump tempsense regs. in decimal, to ease shell-scripts. - */ -@@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); - static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); - static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); - static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); --static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); - static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); - static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); - static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset); -@@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = { - &dev_attr_nfreectxts, - &dev_attr_serial, - &dev_attr_boardversion, -- &dev_attr_logged_errors, - &dev_attr_tempsense, - &dev_attr_localbus_info, - &dev_attr_chip_reset, -diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c -index 05f371df6c40..d4b0a31ab66b 100644 ---- a/drivers/input/tablet/wacom_wac.c -+++ b/drivers/input/tablet/wacom_wac.c -@@ -700,6 +700,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) - input_report_key(input, BTN_7, (data[4] & 0x40)); /* Left */ - input_report_key(input, BTN_8, (data[4] & 0x80)); /* Down */ - input_report_key(input, BTN_0, (data[3] & 0x01)); /* Center */ -+ -+ if (data[4] | (data[3] & 0x01)) { -+ input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); -+ } else { -+ input_report_abs(input, ABS_MISC, 0); -+ } - } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) { - int i; - -diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c -index db404a0f7e2c..d2a8d64f8526 100644 ---- a/drivers/md/dm-io.c -+++ b/drivers/md/dm-io.c -@@ -292,6 +292,12 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, - unsigned short logical_block_size = queue_logical_block_size(q); - sector_t num_sectors; - -+ /* Reject unsupported discard requests */ -+ if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) { -+ dec_count(io, region, -EOPNOTSUPP); -+ return; -+ } -+ - /* - * where->count may be zero if rw holds a flush and we need to - * send a zero-sized flush. -diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c -index 7dfdb5c746d6..089d62751f7f 100644 ---- a/drivers/md/dm-raid1.c -+++ b/drivers/md/dm-raid1.c -@@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context) - return; - } - -+ /* -+ * If the bio is discard, return an error, but do not -+ * degrade the array. -+ */ -+ if (bio->bi_rw & REQ_DISCARD) { -+ bio_endio(bio, -EOPNOTSUPP); -+ return; -+ } -+ - for (i = 0; i < ms->nr_mirrors; i++) - if (test_bit(i, &error)) - fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); -diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c -index ebddef5237e4..c356a10b9ba5 100644 ---- a/drivers/md/dm-snap.c -+++ b/drivers/md/dm-snap.c -@@ -1440,8 +1440,6 @@ out: - full_bio->bi_private = pe->full_bio_private; - atomic_inc(&full_bio->bi_remaining); - } -- free_pending_exception(pe); -- - increment_pending_exceptions_done_count(); - - up_write(&s->lock); -@@ -1458,6 +1456,8 @@ out: - } - - retry_origin_bios(s, origin_bios); -+ -+ free_pending_exception(pe); - } - - static void commit_callback(void *context, int success) -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index 65ee3a0d4683..1582c3dac3ac 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -2288,7 +2288,7 @@ int dm_setup_md_queue(struct mapped_device *md) - return 0; - } - --static struct mapped_device *dm_find_md(dev_t dev) -+struct mapped_device *dm_get_md(dev_t dev) - { - struct mapped_device *md; - unsigned minor = MINOR(dev); -@@ -2299,12 +2299,15 @@ static struct mapped_device *dm_find_md(dev_t dev) - spin_lock(&_minor_lock); - - md = idr_find(&_minor_idr, minor); -- if (md && (md == MINOR_ALLOCED || -- (MINOR(disk_devt(dm_disk(md))) != minor) || -- dm_deleting_md(md) || -- test_bit(DMF_FREEING, &md->flags))) { -- md = NULL; -- goto out; -+ if (md) { -+ if ((md == MINOR_ALLOCED || -+ (MINOR(disk_devt(dm_disk(md))) != minor) || -+ dm_deleting_md(md) || -+ test_bit(DMF_FREEING, &md->flags))) { -+ md = NULL; -+ goto out; -+ } -+ dm_get(md); - } - - out: -@@ -2312,16 +2315,6 @@ out: - - return md; - } -- --struct mapped_device *dm_get_md(dev_t dev) --{ -- struct mapped_device *md = dm_find_md(dev); -- -- if (md) -- dm_get(md); -- -- return md; --} - EXPORT_SYMBOL_GPL(dm_get_md); - - void *dm_get_mdptr(struct mapped_device *md) -diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c -index cdd31c2a2a2b..b2965382d0ec 100644 ---- a/drivers/misc/mei/init.c -+++ b/drivers/misc/mei/init.c -@@ -275,6 +275,8 @@ void mei_stop(struct mei_device *dev) - - dev->dev_state = MEI_DEV_POWER_DOWN; - mei_reset(dev); -+ /* move device to disabled state unconditionally */ -+ dev->dev_state = MEI_DEV_DISABLED; - - mutex_unlock(&dev->device_lock); - -diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c -index 07c942b6ae01..e8c21f911b6f 100644 ---- a/drivers/net/macvtap.c -+++ b/drivers/net/macvtap.c -@@ -637,12 +637,15 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, - } /* else everything is zero */ - } - -+/* Neighbour code has some assumptions on HH_DATA_MOD alignment */ -+#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) -+ - /* Get packet from user space buffer */ - static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, - const struct iovec *iv, unsigned long total_len, - size_t count, int noblock) - { -- int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN); -+ int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE); - struct sk_buff *skb; - struct macvlan_dev *vlan; - unsigned long len = total_len; -@@ -701,7 +704,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, - linear = vnet_hdr.hdr_len; - } - -- skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, -+ skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, - linear, noblock, &err); - if (!skb) - goto err; -diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c -index 76d96b9ebcdb..1d568788c3e3 100644 ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -194,6 +194,25 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features) - } - - /** -+ * phy_check_valid - check if there is a valid PHY setting which matches -+ * speed, duplex, and feature mask -+ * @speed: speed to match -+ * @duplex: duplex to match -+ * @features: A mask of the valid settings -+ * -+ * Description: Returns true if there is a valid setting, false otherwise. -+ */ -+static inline bool phy_check_valid(int speed, int duplex, u32 features) -+{ -+ unsigned int idx; -+ -+ idx = phy_find_valid(phy_find_setting(speed, duplex), features); -+ -+ return settings[idx].speed == speed && settings[idx].duplex == duplex && -+ (settings[idx].setting & features); -+} -+ -+/** - * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex - * @phydev: the target phy_device struct - * -@@ -955,7 +974,6 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - int eee_lp, eee_cap, eee_adv; - u32 lp, cap, adv; - int status; -- unsigned int idx; - - /* Read phy status to properly get the right settings */ - status = phy_read_status(phydev); -@@ -987,8 +1005,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - - adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); - lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); -- idx = phy_find_setting(phydev->speed, phydev->duplex); -- if (!(lp & adv & settings[idx].setting)) -+ if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv)) - return -EPROTONOSUPPORT; - - if (clk_stop_enable) { -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 32efe8371ff8..c28e2dafb3f0 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -42,9 +42,7 @@ - - static struct team_port *team_port_get_rcu(const struct net_device *dev) - { -- struct team_port *port = rcu_dereference(dev->rx_handler_data); -- -- return team_port_exists(dev) ? port : NULL; -+ return rcu_dereference(dev->rx_handler_data); - } - - static struct team_port *team_port_get_rtnl(const struct net_device *dev) -@@ -1725,11 +1723,11 @@ static int team_set_mac_address(struct net_device *dev, void *p) - if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); -- rcu_read_lock(); -- list_for_each_entry_rcu(port, &team->port_list, list) -+ mutex_lock(&team->lock); -+ list_for_each_entry(port, &team->port_list, list) - if (team->ops.port_change_dev_addr) - team->ops.port_change_dev_addr(team, port); -- rcu_read_unlock(); -+ mutex_unlock(&team->lock); - return 0; - } - -diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c -index 3d18bb0eee85..1bfe0fcaccf5 100644 ---- a/drivers/net/usb/plusb.c -+++ b/drivers/net/usb/plusb.c -@@ -134,6 +134,11 @@ static const struct usb_device_id products [] = { - }, { - USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ - .driver_info = (unsigned long) &prolific_info, -+}, { -+ USB_DEVICE(0x3923, 0x7825), /* National Instruments USB -+ * Host-to-Host Cable -+ */ -+ .driver_info = (unsigned long) &prolific_info, - }, - - { }, // END -diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c -index a3399c4f13a9..b9b651ea9851 100644 ---- a/drivers/net/wireless/ath/ath5k/reset.c -+++ b/drivers/net/wireless/ath/ath5k/reset.c -@@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) - regval = ioread32(reg); - iowrite32(regval | val, reg); - regval = ioread32(reg); -- usleep_range(100, 150); -+ udelay(100); /* NB: should be atomic */ - - /* Bring BB/MAC out of reset */ - iowrite32(regval & ~val, reg); -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index 5642a9b250c2..953bd0bfdf0d 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -581,7 +581,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) - "beiscsi_hba_alloc - iscsi_host_alloc failed\n"); - return NULL; - } -- shost->dma_boundary = pcidev->dma_mask; - shost->max_id = BE2_MAX_SESSIONS; - shost->max_channel = 0; - shost->max_cmd_len = BEISCSI_MAX_CMD_LEN; -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c -index df5e961484e1..eb81c98386b9 100644 ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -522,7 +522,7 @@ static ssize_t - sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) - { - sg_io_hdr_t *hp = &srp->header; -- int err = 0; -+ int err = 0, err2; - int len; - - if (count < SZ_SG_IO_HDR) { -@@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) - goto err_out; - } - err_out: -- err = sg_finish_rem_req(srp); -- return (0 == err) ? count : err; -+ err2 = sg_finish_rem_req(srp); -+ return err ? : err2 ? : count; - } - - static ssize_t -diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c -index 1e9da405d833..528781049ad5 100644 ---- a/drivers/staging/comedi/comedi_compat32.c -+++ b/drivers/staging/comedi/comedi_compat32.c -@@ -262,7 +262,7 @@ static int compat_cmd(struct file *file, unsigned long arg) - { - struct comedi_cmd __user *cmd; - struct comedi32_cmd_struct __user *cmd32; -- int rc; -+ int rc, err; - - cmd32 = compat_ptr(arg); - cmd = compat_alloc_user_space(sizeof(*cmd)); -@@ -271,7 +271,15 @@ static int compat_cmd(struct file *file, unsigned long arg) - if (rc) - return rc; - -- return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); -+ rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); -+ if (rc == -EAGAIN) { -+ /* Special case: copy cmd back to user. */ -+ err = put_compat_cmd(cmd32, cmd); -+ if (err) -+ rc = err; -+ } -+ -+ return rc; - } - - /* Handle 32-bit COMEDI_CMDTEST ioctl. */ -diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c -index 4fff1738e3f8..3d1cb5b0a956 100644 ---- a/drivers/staging/comedi/drivers/cb_pcidas64.c -+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c -@@ -441,6 +441,29 @@ static const struct comedi_lrange ai_ranges_64xx = { - } - }; - -+static const uint8_t ai_range_code_64xx[8] = { -+ 0x0, 0x1, 0x2, 0x3, /* bipolar 10, 5, 2,5, 1.25 */ -+ 0x8, 0x9, 0xa, 0xb /* unipolar 10, 5, 2.5, 1.25 */ -+}; -+ -+/* analog input ranges for 64-Mx boards */ -+static const struct comedi_lrange ai_ranges_64_mx = { -+ 7, { -+ BIP_RANGE(5), -+ BIP_RANGE(2.5), -+ BIP_RANGE(1.25), -+ BIP_RANGE(0.625), -+ UNI_RANGE(5), -+ UNI_RANGE(2.5), -+ UNI_RANGE(1.25) -+ } -+}; -+ -+static const uint8_t ai_range_code_64_mx[7] = { -+ 0x0, 0x1, 0x2, 0x3, /* bipolar 5, 2.5, 1.25, 0.625 */ -+ 0x9, 0xa, 0xb /* unipolar 5, 2.5, 1.25 */ -+}; -+ - /* analog input ranges for 60xx boards */ - static const struct comedi_lrange ai_ranges_60xx = { - 4, { -@@ -451,6 +474,10 @@ static const struct comedi_lrange ai_ranges_60xx = { - } - }; - -+static const uint8_t ai_range_code_60xx[4] = { -+ 0x0, 0x1, 0x4, 0x7 /* bipolar 10, 5, 0.5, 0.05 */ -+}; -+ - /* analog input ranges for 6030, etc boards */ - static const struct comedi_lrange ai_ranges_6030 = { - 14, { -@@ -471,6 +498,11 @@ static const struct comedi_lrange ai_ranges_6030 = { - } - }; - -+static const uint8_t ai_range_code_6030[14] = { -+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ -+ 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ -+}; -+ - /* analog input ranges for 6052, etc boards */ - static const struct comedi_lrange ai_ranges_6052 = { - 15, { -@@ -492,6 +524,11 @@ static const struct comedi_lrange ai_ranges_6052 = { - } - }; - -+static const uint8_t ai_range_code_6052[15] = { -+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, /* bipolar 10 ... 0.05 */ -+ 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* unipolar 10 ... 0.1 */ -+}; -+ - /* analog input ranges for 4020 board */ - static const struct comedi_lrange ai_ranges_4020 = { - 2, { -@@ -595,6 +632,7 @@ struct pcidas64_board { - int ai_bits; /* analog input resolution */ - int ai_speed; /* fastest conversion period in ns */ - const struct comedi_lrange *ai_range_table; -+ const uint8_t *ai_range_code; - int ao_nchan; /* number of analog out channels */ - int ao_bits; /* analog output resolution */ - int ao_scan_speed; /* analog output scan speed */ -@@ -653,6 +691,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -668,6 +707,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -682,7 +722,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -697,7 +738,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -712,7 +754,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -727,6 +770,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -742,6 +786,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -756,6 +801,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -771,6 +817,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -786,6 +833,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -801,6 +849,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -814,6 +863,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -825,6 +875,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -837,6 +888,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -850,6 +902,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -865,6 +918,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -880,6 +934,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -895,6 +950,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 3333, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -910,6 +966,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -925,6 +982,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -959,6 +1017,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -970,7 +1029,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -982,7 +1042,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -994,7 +1055,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1006,7 +1068,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1018,7 +1081,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1030,7 +1094,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1127,45 +1192,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev, - unsigned int range_index) - { - const struct pcidas64_board *thisboard = comedi_board(dev); -- const struct comedi_krange *range = -- &thisboard->ai_range_table->range[range_index]; -- unsigned int bits = 0; - -- switch (range->max) { -- case 10000000: -- bits = 0x000; -- break; -- case 5000000: -- bits = 0x100; -- break; -- case 2000000: -- case 2500000: -- bits = 0x200; -- break; -- case 1000000: -- case 1250000: -- bits = 0x300; -- break; -- case 500000: -- bits = 0x400; -- break; -- case 200000: -- case 250000: -- bits = 0x500; -- break; -- case 100000: -- bits = 0x600; -- break; -- case 50000: -- bits = 0x700; -- break; -- default: -- comedi_error(dev, "bug! in ai_range_bits_6xxx"); -- break; -- } -- if (range->min == 0) -- bits += 0x900; -- return bits; -+ return thisboard->ai_range_code[range_index] << 8; - } - - static unsigned int hw_revision(const struct comedi_device *dev, -diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c -index 9ec1df9cff95..be89260c23a6 100644 ---- a/drivers/staging/iio/adc/mxs-lradc.c -+++ b/drivers/staging/iio/adc/mxs-lradc.c -@@ -214,11 +214,17 @@ struct mxs_lradc { - unsigned long is_divided; - - /* -- * Touchscreen LRADC channels receives a private slot in the CTRL4 -- * register, the slot #7. Therefore only 7 slots instead of 8 in the -- * CTRL4 register can be mapped to LRADC channels when using the -- * touchscreen. -- * -+ * When the touchscreen is enabled, we give it two private virtual -+ * channels: #6 and #7. This means that only 6 virtual channels (instead -+ * of 8) will be available for buffered capture. -+ */ -+#define TOUCHSCREEN_VCHANNEL1 7 -+#define TOUCHSCREEN_VCHANNEL2 6 -+#define BUFFER_VCHANS_LIMITED 0x3f -+#define BUFFER_VCHANS_ALL 0xff -+ u8 buffer_vchans; -+ -+ /* - * Furthermore, certain LRADC channels are shared between touchscreen - * and/or touch-buttons and generic LRADC block. Therefore when using - * either of these, these channels are not available for the regular -@@ -342,6 +348,9 @@ struct mxs_lradc { - #define LRADC_CTRL4 0x140 - #define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4)) - #define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4) -+#define LRADC_CTRL4_LRADCSELECT(n, x) \ -+ (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \ -+ LRADC_CTRL4_LRADCSELECT_MASK(n)) - - #define LRADC_RESOLUTION 12 - #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1) -@@ -423,6 +432,14 @@ static bool mxs_lradc_check_touch_event(struct mxs_lradc *lradc) - LRADC_STATUS_TOUCH_DETECT_RAW); - } - -+static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch, -+ unsigned ch) -+{ -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch), -+ LRADC_CTRL4); -+ mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4); -+} -+ - static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) - { - /* -@@ -450,12 +467,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) - LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), - LRADC_DELAY(3)); - -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | -- LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | -- LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1); - -- /* wake us again, when the complete conversion is done */ -- mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1); - /* - * after changing the touchscreen plates setting - * the signals need some initial time to settle. Start the -@@ -508,12 +521,8 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1, - LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), - LRADC_DELAY(3)); - -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | -- LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | -- LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1); - -- /* wake us again, when the conversions are done */ -- mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1); - /* - * after changing the touchscreen plates setting - * the signals need some initial time to settle. Start the -@@ -578,36 +587,6 @@ static unsigned mxs_lradc_read_ts_pressure(struct mxs_lradc *lradc, - #define TS_CH_XM 4 - #define TS_CH_YM 5 - --static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc) --{ -- u32 reg; -- int val; -- -- reg = readl(lradc->base + LRADC_CTRL1); -- -- /* only channels 3 to 5 are of interest here */ -- if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) { -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) | -- LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1); -- val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP); -- } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) { -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) | -- LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1); -- val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM); -- } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) { -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) | -- LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1); -- val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM); -- } else { -- return -EIO; -- } -- -- mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); -- mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); -- -- return val; --} -- - /* - * YP(open)--+-------------+ - * | |--+ -@@ -651,7 +630,8 @@ static void mxs_lradc_prepare_x_pos(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0); - - lradc->cur_plate = LRADC_SAMPLE_X; -- mxs_lradc_setup_ts_channel(lradc, TS_CH_YP); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP); -+ mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); - } - - /* -@@ -672,7 +652,8 @@ static void mxs_lradc_prepare_y_pos(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0); - - lradc->cur_plate = LRADC_SAMPLE_Y; -- mxs_lradc_setup_ts_channel(lradc, TS_CH_XM); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM); -+ mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); - } - - /* -@@ -693,7 +674,10 @@ static void mxs_lradc_prepare_pressure(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0); - - lradc->cur_plate = LRADC_SAMPLE_PRESSURE; -- mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM); -+ mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP); -+ mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2, -+ TOUCHSCREEN_VCHANNEL1); - } - - static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) -@@ -706,6 +690,19 @@ static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) - mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); - } - -+static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc) -+{ -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, -+ LRADC_CTRL1); -+ mxs_lradc_reg_set(lradc, -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); -+ /* -+ * start with the Y-pos, because it uses nearly the same plate -+ * settings like the touch detection -+ */ -+ mxs_lradc_prepare_y_pos(lradc); -+} -+ - static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc) - { - input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos); -@@ -723,10 +720,12 @@ static void mxs_lradc_complete_touch_event(struct mxs_lradc *lradc) - * start a dummy conversion to burn time to settle the signals - * note: we are not interested in the conversion's value - */ -- mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5)); -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); -- mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1); -- mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) | -+ mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1)); -+ mxs_lradc_reg_clear(lradc, -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); -+ mxs_lradc_reg_wrt(lradc, -+ LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) | - LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */ - LRADC_DELAY(2)); - } -@@ -758,59 +757,45 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) - - /* if it is released, wait for the next touch via IRQ */ - lradc->cur_plate = LRADC_TOUCH; -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); -+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); -+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ | -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); - mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); - } - - /* touchscreen's state machine */ - static void mxs_lradc_handle_touch(struct mxs_lradc *lradc) - { -- int val; -- - switch (lradc->cur_plate) { - case LRADC_TOUCH: -- /* -- * start with the Y-pos, because it uses nearly the same plate -- * settings like the touch detection -- */ -- if (mxs_lradc_check_touch_event(lradc)) { -- mxs_lradc_reg_clear(lradc, -- LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, -- LRADC_CTRL1); -- mxs_lradc_prepare_y_pos(lradc); -- } -+ if (mxs_lradc_check_touch_event(lradc)) -+ mxs_lradc_start_touch_event(lradc); - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, - LRADC_CTRL1); - return; - - case LRADC_SAMPLE_Y: -- val = mxs_lradc_read_ts_channel(lradc); -- if (val < 0) { -- mxs_lradc_enable_touch_detection(lradc); /* re-start */ -- return; -- } -- lradc->ts_y_pos = val; -+ lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc, -+ TOUCHSCREEN_VCHANNEL1); - mxs_lradc_prepare_x_pos(lradc); - return; - - case LRADC_SAMPLE_X: -- val = mxs_lradc_read_ts_channel(lradc); -- if (val < 0) { -- mxs_lradc_enable_touch_detection(lradc); /* re-start */ -- return; -- } -- lradc->ts_x_pos = val; -+ lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc, -+ TOUCHSCREEN_VCHANNEL1); - mxs_lradc_prepare_pressure(lradc); - return; - - case LRADC_SAMPLE_PRESSURE: -- lradc->ts_pressure = -- mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); -+ lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc, -+ TOUCHSCREEN_VCHANNEL2, -+ TOUCHSCREEN_VCHANNEL1); - mxs_lradc_complete_touch_event(lradc); - return; - - case LRADC_SAMPLE_VALID: -- val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */ - mxs_lradc_finish_touch_event(lradc, 1); - break; - } -@@ -842,9 +827,9 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) - * used if doing raw sampling. - */ - if (lradc->soc == IMX28_LRADC) -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, -+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), - LRADC_CTRL1); -- mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); -+ mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0); - - /* Enable / disable the divider per requirement */ - if (test_bit(chan, &lradc->is_divided)) -@@ -1091,9 +1076,8 @@ static void mxs_lradc_disable_ts(struct mxs_lradc *lradc) - { - /* stop all interrupts from firing */ - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN | -- LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) | -- LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5), -- LRADC_CTRL1); -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); - - /* Power-down touchscreen touch-detect circuitry. */ - mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0); -@@ -1159,25 +1143,31 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data) - struct iio_dev *iio = data; - struct mxs_lradc *lradc = iio_priv(iio); - unsigned long reg = readl(lradc->base + LRADC_CTRL1); -+ uint32_t clr_irq = mxs_lradc_irq_mask(lradc); - const uint32_t ts_irq_mask = - LRADC_CTRL1_TOUCH_DETECT_IRQ | -- LRADC_CTRL1_LRADC_IRQ(2) | -- LRADC_CTRL1_LRADC_IRQ(3) | -- LRADC_CTRL1_LRADC_IRQ(4) | -- LRADC_CTRL1_LRADC_IRQ(5); -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2); - - if (!(reg & mxs_lradc_irq_mask(lradc))) - return IRQ_NONE; - -- if (lradc->use_touchscreen && (reg & ts_irq_mask)) -+ if (lradc->use_touchscreen && (reg & ts_irq_mask)) { - mxs_lradc_handle_touch(lradc); -+ /* Make sure we don't clear the next conversion's interrupt. */ -+ clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | -+ LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); -+ } - - if (iio_buffer_enabled(iio)) -- iio_trigger_poll(iio->trig, iio_get_time_ns()); -- else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) -+ if (iio_buffer_enabled(iio)) { -+ if (reg & lradc->buffer_vchans) -+ iio_trigger_poll(iio->trig, iio_get_time_ns()); -+ } else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) { - complete(&lradc->completion); -+ } - -- mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1); - - return IRQ_HANDLED; - } -@@ -1288,9 +1278,10 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) - } - - if (lradc->soc == IMX28_LRADC) -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, -- LRADC_CTRL1); -- mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); -+ mxs_lradc_reg_clear(lradc, -+ lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, -+ LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); - - for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { - ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); -@@ -1323,10 +1314,11 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio) - mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | - LRADC_DELAY_KICK, LRADC_DELAY(0)); - -- mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); -+ mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); - if (lradc->soc == IMX28_LRADC) -- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, -- LRADC_CTRL1); -+ mxs_lradc_reg_clear(lradc, -+ lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, -+ LRADC_CTRL1); - - kfree(lradc->buffer); - mutex_unlock(&lradc->lock); -@@ -1352,7 +1344,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio, - if (lradc->use_touchbutton) - rsvd_chans++; - if (lradc->use_touchscreen) -- rsvd_chans++; -+ rsvd_chans += 2; - - /* Test for attempts to map channels with special mode of operation. */ - if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS)) -@@ -1412,6 +1404,13 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { - .channel = 8, - .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, - }, -+ /* Hidden channel to keep indexes */ -+ { -+ .type = IIO_TEMP, -+ .indexed = 1, -+ .scan_index = -1, -+ .channel = 9, -+ }, - MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ - MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ - MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ -@@ -1563,6 +1562,11 @@ static int mxs_lradc_probe(struct platform_device *pdev) - - touch_ret = mxs_lradc_probe_touchscreen(lradc, node); - -+ if (touch_ret == 0) -+ lradc->buffer_vchans = BUFFER_VCHANS_LIMITED; -+ else -+ lradc->buffer_vchans = BUFFER_VCHANS_ALL; -+ - /* Grab all IRQ sources */ - for (i = 0; i < of_cfg->irq_count; i++) { - lradc->irq[i] = platform_get_irq(pdev, i); -diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c -index 1205dbd4f83d..0fccdcfd1015 100644 ---- a/drivers/target/target_core_pr.c -+++ b/drivers/target/target_core_pr.c -@@ -1877,8 +1877,8 @@ static int core_scsi3_update_aptpl_buf( - } - - if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { -- pr_err("Unable to update renaming" -- " APTPL metadata\n"); -+ pr_err("Unable to update renaming APTPL metadata," -+ " reallocating larger buffer\n"); - ret = -EMSGSIZE; - goto out; - } -@@ -1895,8 +1895,8 @@ static int core_scsi3_update_aptpl_buf( - lun->lun_sep->sep_rtpi, lun->unpacked_lun, reg_count); - - if ((len + strlen(tmp) >= pr_aptpl_buf_len)) { -- pr_err("Unable to update renaming" -- " APTPL metadata\n"); -+ pr_err("Unable to update renaming APTPL metadata," -+ " reallocating larger buffer\n"); - ret = -EMSGSIZE; - goto out; - } -@@ -1959,7 +1959,7 @@ static int __core_scsi3_write_aptpl_to_file( - static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, bool aptpl) - { - unsigned char *buf; -- int rc; -+ int rc, len = PR_APTPL_BUF_LEN; - - if (!aptpl) { - char *null_buf = "No Registrations or Reservations\n"; -@@ -1973,25 +1973,26 @@ static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, b - - return 0; - } -- -- buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL); -+retry: -+ buf = vzalloc(len); - if (!buf) - return TCM_OUT_OF_RESOURCES; - -- rc = core_scsi3_update_aptpl_buf(dev, buf, PR_APTPL_BUF_LEN); -+ rc = core_scsi3_update_aptpl_buf(dev, buf, len); - if (rc < 0) { -- kfree(buf); -- return TCM_OUT_OF_RESOURCES; -+ vfree(buf); -+ len *= 2; -+ goto retry; - } - - rc = __core_scsi3_write_aptpl_to_file(dev, buf); - if (rc != 0) { - pr_err("SPC-3 PR: Could not update APTPL\n"); -- kfree(buf); -+ vfree(buf); - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - } - dev->t10_pr.pr_aptpl_active = 1; -- kfree(buf); -+ vfree(buf); - pr_debug("SPC-3 PR: Set APTPL Bit Activated\n"); - return 0; - } -diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c -index 5216acd68b4b..68511e83486b 100644 ---- a/drivers/target/target_core_sbc.c -+++ b/drivers/target/target_core_sbc.c -@@ -266,6 +266,8 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb) - static sense_reason_t - sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) - { -+ struct se_device *dev = cmd->se_dev; -+ sector_t end_lba = dev->transport->get_blocks(dev) + 1; - unsigned int sectors = sbc_get_write_same_sectors(cmd); - - if ((flags[0] & 0x04) || (flags[0] & 0x02)) { -@@ -279,6 +281,16 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o - sectors, cmd->se_dev->dev_attrib.max_write_same_len); - return TCM_INVALID_CDB_FIELD; - } -+ /* -+ * Sanity check for LBA wrap and request past end of device. -+ */ -+ if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || -+ ((cmd->t_task_lba + sectors) > end_lba)) { -+ pr_err("WRITE_SAME exceeds last lba %llu (lba %llu, sectors %u)\n", -+ (unsigned long long)end_lba, cmd->t_task_lba, sectors); -+ return TCM_ADDRESS_OUT_OF_RANGE; -+ } -+ - /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ - if (flags[0] & 0x10) { - pr_warn("WRITE SAME with ANCHOR not supported\n"); -@@ -911,7 +923,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - unsigned long long end_lba; - - end_lba = dev->transport->get_blocks(dev) + 1; -- if (cmd->t_task_lba + sectors > end_lba) { -+ if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || -+ ((cmd->t_task_lba + sectors) > end_lba)) { - pr_err("cmd exceeds last lba %llu " - "(lba %llu, sectors %u)\n", - end_lba, cmd->t_task_lba, sectors); -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index 25d07412e08e..39988fa91294 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -996,8 +996,8 @@ EXPORT_SYMBOL(start_tty); - /* We limit tty time update visibility to every 8 seconds or so. */ - static void tty_update_time(struct timespec *time) - { -- unsigned long sec = get_seconds() & ~7; -- if ((long)(sec - time->tv_sec) > 0) -+ unsigned long sec = get_seconds(); -+ if (abs(sec - time->tv_sec) & ~7) - time->tv_sec = sec; - } - -diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c -index 6fd60fece6b4..22da05d27009 100644 ---- a/drivers/tty/tty_ioctl.c -+++ b/drivers/tty/tty_ioctl.c -@@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) - #endif - if (!timeout) - timeout = MAX_SCHEDULE_TIMEOUT; -+ - if (wait_event_interruptible_timeout(tty->write_wait, -- !tty_chars_in_buffer(tty), timeout) >= 0) { -- if (tty->ops->wait_until_sent) -- tty->ops->wait_until_sent(tty, timeout); -+ !tty_chars_in_buffer(tty), timeout) < 0) { -+ return; - } -+ -+ if (timeout == MAX_SCHEDULE_TIMEOUT) -+ timeout = 0; -+ -+ if (tty->ops->wait_until_sent) -+ tty->ops->wait_until_sent(tty, timeout); - } - EXPORT_SYMBOL(tty_wait_until_sent); - -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 9ca77166d37e..45b7b96f9ed3 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb) - as->status = urb->status; - signr = as->signr; - if (signr) { -+ memset(&sinfo, 0, sizeof(sinfo)); - sinfo.si_signo = as->signr; - sinfo.si_errno = as->status; - sinfo.si_code = SI_ASYNCIO; -@@ -2227,6 +2228,7 @@ static void usbdev_remove(struct usb_device *udev) - wake_up_all(&ps->wait); - list_del_init(&ps->list); - if (ps->discsignr) { -+ memset(&sinfo, 0, sizeof(sinfo)); - sinfo.si_signo = ps->discsignr; - sinfo.si_errno = EPIPE; - sinfo.si_code = SI_ASYNCIO; -diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c -index 2a6841c95b64..cfca302d3d88 100644 ---- a/drivers/usb/dwc3/dwc3-omap.c -+++ b/drivers/usb/dwc3/dwc3-omap.c -@@ -211,6 +211,18 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value) - omap->irq0_offset, value); - } - -+static void dwc3_omap_write_irqmisc_clr(struct dwc3_omap *omap, u32 value) -+{ -+ dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_MISC + -+ omap->irqmisc_offset, value); -+} -+ -+static void dwc3_omap_write_irq0_clr(struct dwc3_omap *omap, u32 value) -+{ -+ dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_0 - -+ omap->irq0_offset, value); -+} -+ - static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, - enum omap_dwc3_vbus_id_status status) - { -@@ -351,9 +363,23 @@ static void dwc3_omap_enable_irqs(struct dwc3_omap *omap) - - static void dwc3_omap_disable_irqs(struct dwc3_omap *omap) - { -+ u32 reg; -+ - /* disable all IRQs */ -- dwc3_omap_write_irqmisc_set(omap, 0x00); -- dwc3_omap_write_irq0_set(omap, 0x00); -+ reg = USBOTGSS_IRQO_COREIRQ_ST; -+ dwc3_omap_write_irq0_clr(omap, reg); -+ -+ reg = (USBOTGSS_IRQMISC_OEVT | -+ USBOTGSS_IRQMISC_DRVVBUS_RISE | -+ USBOTGSS_IRQMISC_CHRGVBUS_RISE | -+ USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | -+ USBOTGSS_IRQMISC_IDPULLUP_RISE | -+ USBOTGSS_IRQMISC_DRVVBUS_FALL | -+ USBOTGSS_IRQMISC_CHRGVBUS_FALL | -+ USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | -+ USBOTGSS_IRQMISC_IDPULLUP_FALL); -+ -+ dwc3_omap_write_irqmisc_clr(omap, reg); - } - - static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32); -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index faa8b98954d9..a95eee8ddc38 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -2133,7 +2133,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - if (event_trb != ep_ring->dequeue) { - /* The event was for the status stage */ - if (event_trb == td->last_trb) { -- if (td->urb->actual_length != 0) { -+ if (td->urb_length_set) { - /* Don't overwrite a previously set error code - */ - if ((*status == -EINPROGRESS || *status == 0) && -@@ -2147,7 +2147,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - td->urb->transfer_buffer_length; - } - } else { -- /* Maybe the event was for the data stage? */ -+ /* -+ * Maybe the event was for the data stage? If so, update -+ * already the actual_length of the URB and flag it as -+ * set, so that it is not overwritten in the event for -+ * the last TRB. -+ */ -+ td->urb_length_set = true; - td->urb->actual_length = - td->urb->transfer_buffer_length - - EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 96e9e780ccae..7225dd242bfa 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1,3 +1,4 @@ -+ - /* - * xHCI host controller driver - * -@@ -88,9 +89,10 @@ struct xhci_cap_regs { - #define HCS_IST(p) (((p) >> 0) & 0xf) - /* bits 4:7, max number of Event Ring segments */ - #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf) -+/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */ - /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ --/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */ --#define HCS_MAX_SCRATCHPAD(p) (((p) >> 27) & 0x1f) -+/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */ -+#define HCS_MAX_SCRATCHPAD(p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f)) - - /* HCSPARAMS3 - hcs_params3 - bitmasks */ - /* bits 0:7, Max U1 to U0 latency for the roothub ports */ -@@ -1289,6 +1291,8 @@ struct xhci_td { - struct xhci_segment *start_seg; - union xhci_trb *first_trb; - union xhci_trb *last_trb; -+ /* actual_length of the URB has already been set */ -+ bool urb_length_set; - }; - - /* xHCI command default timeout value */ -diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c -index 9374bd2aba20..6f91eb9ae81a 100644 ---- a/drivers/usb/serial/bus.c -+++ b/drivers/usb/serial/bus.c -@@ -51,6 +51,7 @@ static int usb_serial_device_probe(struct device *dev) - { - struct usb_serial_driver *driver; - struct usb_serial_port *port; -+ struct device *tty_dev; - int retval = 0; - int minor; - -@@ -75,12 +76,20 @@ static int usb_serial_device_probe(struct device *dev) - retval = device_create_file(dev, &dev_attr_port_number); - if (retval) { - if (driver->port_remove) -- retval = driver->port_remove(port); -+ driver->port_remove(port); - goto exit_with_autopm; - } - - minor = port->minor; -- tty_register_device(usb_serial_tty_driver, minor, dev); -+ tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev); -+ if (IS_ERR(tty_dev)) { -+ retval = PTR_ERR(tty_dev); -+ device_remove_file(dev, &dev_attr_port_number); -+ if (driver->port_remove) -+ driver->port_remove(port); -+ goto exit_with_autopm; -+ } -+ - dev_info(&port->serial->dev->dev, - "%s converter now attached to ttyUSB%d\n", - driver->description, minor); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index a2d040971afe..8d114b9733ed 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ - { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ - { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ -+ { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */ -+ { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */ - { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ - { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ - { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index debcdef4cbf0..923500595357 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -812,6 +812,8 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, -+ { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), -+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), -@@ -991,6 +993,23 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, - /* GE Healthcare devices */ - { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, -+ /* Active Research (Actisense) devices */ -+ { USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) }, -+ { USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) }, -+ { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) }, - { } /* Terminating entry */ - }; - -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index e52409c9be99..56b1b55c4751 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -38,6 +38,9 @@ - - #define FTDI_LUMEL_PD12_PID 0x6002 - -+/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ -+#define CYBER_CORTEX_AV_PID 0x8698 -+ - /* - * Marvell OpenRD Base, Client - * http://www.open-rd.org -@@ -1438,3 +1441,23 @@ - */ - #define GE_HEALTHCARE_VID 0x1901 - #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 -+ -+/* -+ * Active Research (Actisense) devices -+ */ -+#define ACTISENSE_NDC_PID 0xD9A8 /* NDC USB Serial Adapter */ -+#define ACTISENSE_USG_PID 0xD9A9 /* USG USB Serial Adapter */ -+#define ACTISENSE_NGT_PID 0xD9AA /* NGT NMEA2000 Interface */ -+#define ACTISENSE_NGW_PID 0xD9AB /* NGW NMEA2000 Gateway */ -+#define ACTISENSE_D9AC_PID 0xD9AC /* Actisense Reserved */ -+#define ACTISENSE_D9AD_PID 0xD9AD /* Actisense Reserved */ -+#define ACTISENSE_D9AE_PID 0xD9AE /* Actisense Reserved */ -+#define ACTISENSE_D9AF_PID 0xD9AF /* Actisense Reserved */ -+#define CHETCO_SEAGAUGE_PID 0xA548 /* SeaGauge USB Adapter */ -+#define CHETCO_SEASWITCH_PID 0xA549 /* SeaSwitch USB Adapter */ -+#define CHETCO_SEASMART_NMEA2000_PID 0xA54A /* SeaSmart NMEA2000 Gateway */ -+#define CHETCO_SEASMART_ETHERNET_PID 0xA54B /* SeaSmart Ethernet Gateway */ -+#define CHETCO_SEASMART_WIFI_PID 0xA5AC /* SeaSmart Wifi Gateway */ -+#define CHETCO_SEASMART_DISPLAY_PID 0xA5AD /* SeaSmart NMEA2000 Display */ -+#define CHETCO_SEASMART_LITE_PID 0xA5AE /* SeaSmart Lite USB Adapter */ -+#define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */ -diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c -index b63ce023f96f..d6a197917ebd 100644 ---- a/drivers/usb/serial/generic.c -+++ b/drivers/usb/serial/generic.c -@@ -258,7 +258,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) - * character or at least one jiffy. - */ - period = max_t(unsigned long, (10 * HZ / bps), 1); -- period = min_t(unsigned long, period, timeout); -+ if (timeout) -+ period = min_t(unsigned long, period, timeout); - - dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", - __func__, jiffies_to_msecs(timeout), -@@ -268,7 +269,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) - schedule_timeout_interruptible(period); - if (signal_pending(current)) - break; -- if (time_after(jiffies, expire)) -+ if (timeout && time_after(jiffies, expire)) - break; - } - } -diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c -index ab1d690274ae..460a40669967 100644 ---- a/drivers/usb/serial/mxuport.c -+++ b/drivers/usb/serial/mxuport.c -@@ -1284,7 +1284,8 @@ static int mxuport_open(struct tty_struct *tty, struct usb_serial_port *port) - } - - /* Initial port termios */ -- mxuport_set_termios(tty, port, NULL); -+ if (tty) -+ mxuport_set_termios(tty, port, NULL); - - /* - * TODO: use RQ_VENDOR_GET_MSR, once we know what it -diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c -index 3182c0e68b42..e3399dc2453b 100644 ---- a/fs/autofs4/dev-ioctl.c -+++ b/fs/autofs4/dev-ioctl.c -@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param) - */ - static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in) - { -- struct autofs_dev_ioctl tmp; -+ struct autofs_dev_ioctl tmp, *res; - - if (copy_from_user(&tmp, in, sizeof(tmp))) - return ERR_PTR(-EFAULT); -@@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i - if (tmp.size < sizeof(tmp)) - return ERR_PTR(-EINVAL); - -- return memdup_user(in, tmp.size); -+ res = memdup_user(in, tmp.size); -+ if (!IS_ERR(res)) -+ res->size = tmp.size; -+ -+ return res; - } - - static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index 279b06ef5522..0a841ddd6843 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -1774,22 +1774,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, - mutex_unlock(&inode->i_mutex); - - /* -- * we want to make sure fsync finds this change -- * but we haven't joined a transaction running right now. -- * -- * Later on, someone is sure to update the inode and get the -- * real transid recorded. -- * -- * We set last_trans now to the fs_info generation + 1, -- * this will either be one more than the running transaction -- * or the generation used for the next transaction if there isn't -- * one running right now. -- * - * We also have to set last_sub_trans to the current log transid, - * otherwise subsequent syncs to a file that's been synced in this - * transaction will appear to have already occured. - */ -- BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; - BTRFS_I(inode)->last_sub_trans = root->log_transid; - if (num_written > 0) { - err = generic_write_sync(file, pos, num_written); -@@ -1892,25 +1880,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) - atomic_inc(&root->log_batch); - - /* -- * check the transaction that last modified this inode -- * and see if its already been committed -- */ -- if (!BTRFS_I(inode)->last_trans) { -- mutex_unlock(&inode->i_mutex); -- goto out; -- } -- -- /* -- * if the last transaction that changed this file was before -- * the current transaction, we can bail out now without any -- * syncing -+ * If the last transaction that changed this file was before the current -+ * transaction and we have the full sync flag set in our inode, we can -+ * bail out now without any syncing. -+ * -+ * Note that we can't bail out if the full sync flag isn't set. This is -+ * because when the full sync flag is set we start all ordered extents -+ * and wait for them to fully complete - when they complete they update -+ * the inode's last_trans field through: -+ * -+ * btrfs_finish_ordered_io() -> -+ * btrfs_update_inode_fallback() -> -+ * btrfs_update_inode() -> -+ * btrfs_set_inode_last_trans() -+ * -+ * So we are sure that last_trans is up to date and can do this check to -+ * bail out safely. For the fast path, when the full sync flag is not -+ * set in our inode, we can not do it because we start only our ordered -+ * extents and don't wait for them to complete (that is when -+ * btrfs_finish_ordered_io runs), so here at this point their last_trans -+ * value might be less than or equals to fs_info->last_trans_committed, -+ * and setting a speculative last_trans for an inode when a buffered -+ * write is made (such as fs_info->generation + 1 for example) would not -+ * be reliable since after setting the value and before fsync is called -+ * any number of transactions can start and commit (transaction kthread -+ * commits the current transaction periodically), and a transaction -+ * commit does not start nor waits for ordered extents to complete. - */ - smp_mb(); - if (btrfs_inode_in_log(inode, root->fs_info->generation) || -- BTRFS_I(inode)->last_trans <= -- root->fs_info->last_trans_committed) { -- BTRFS_I(inode)->last_trans = 0; -- -+ (full_sync && BTRFS_I(inode)->last_trans <= -+ root->fs_info->last_trans_committed)) { - /* - * We'v had everything committed since the last time we were - * modified so clear this flag in case it was set for whatever -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index d68a7250f00b..653cdd85e0f2 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -6870,7 +6870,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, - ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) && - em->block_start != EXTENT_MAP_HOLE)) { - int type; -- int ret; - u64 block_start, orig_start, orig_block_len, ram_bytes; - - if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index aeb57b98c53f..a7f32bfdd5e7 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -979,7 +979,7 @@ again: - base = btrfs_item_ptr_offset(leaf, path->slots[0]); - - while (cur_offset < item_size) { -- extref = (struct btrfs_inode_extref *)base + cur_offset; -+ extref = (struct btrfs_inode_extref *)(base + cur_offset); - - victim_name_len = btrfs_inode_extref_name_len(leaf, extref); - -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c -index 15761957cc3f..1ff8fe5dab0d 100644 ---- a/fs/debugfs/inode.c -+++ b/fs/debugfs/inode.c -@@ -245,10 +245,19 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) - return 0; - } - -+static void debugfs_evict_inode(struct inode *inode) -+{ -+ truncate_inode_pages(&inode->i_data, 0); -+ clear_inode(inode); -+ if (S_ISLNK(inode->i_mode)) -+ kfree(inode->i_private); -+} -+ - static const struct super_operations debugfs_super_operations = { - .statfs = simple_statfs, - .remount_fs = debugfs_remount, - .show_options = debugfs_show_options, -+ .evict_inode = debugfs_evict_inode, - }; - - static int debug_fill_super(struct super_block *sb, void *data, int silent) -@@ -465,23 +474,14 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) - int ret = 0; - - if (debugfs_positive(dentry)) { -- if (dentry->d_inode) { -- dget(dentry); -- switch (dentry->d_inode->i_mode & S_IFMT) { -- case S_IFDIR: -- ret = simple_rmdir(parent->d_inode, dentry); -- break; -- case S_IFLNK: -- kfree(dentry->d_inode->i_private); -- /* fall through */ -- default: -- simple_unlink(parent->d_inode, dentry); -- break; -- } -- if (!ret) -- d_delete(dentry); -- dput(dentry); -- } -+ dget(dentry); -+ if (S_ISDIR(dentry->d_inode->i_mode)) -+ ret = simple_rmdir(parent->d_inode, dentry); -+ else -+ simple_unlink(parent->d_inode, dentry); -+ if (!ret) -+ d_delete(dentry); -+ dput(dentry); - } - return ret; - } -diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c -index 3ed1be9aade3..2ea3537b8bde 100644 ---- a/fs/nfs/delegation.c -+++ b/fs/nfs/delegation.c -@@ -161,8 +161,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, - &delegation->flags); - NFS_I(inode)->delegation_state = delegation->type; - spin_unlock(&delegation->lock); -- put_rpccred(oldcred); - rcu_read_unlock(); -+ put_rpccred(oldcred); - trace_nfs4_reclaim_delegation(inode, res->delegation_type); - } else { - /* We appear to have raced with a delegation return. */ -diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c -index b2e3ff347620..ecdbae19a766 100644 ---- a/fs/nilfs2/btree.c -+++ b/fs/nilfs2/btree.c -@@ -31,6 +31,8 @@ - #include "alloc.h" - #include "dat.h" - -+static void __nilfs_btree_init(struct nilfs_bmap *bmap); -+ - static struct nilfs_btree_path *nilfs_btree_alloc_path(void) - { - struct nilfs_btree_path *path; -@@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, - return ret; - } - -+/** -+ * nilfs_btree_root_broken - verify consistency of btree root node -+ * @node: btree root node to be examined -+ * @ino: inode number -+ * -+ * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. -+ */ -+static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, -+ unsigned long ino) -+{ -+ int level, flags, nchildren; -+ int ret = 0; -+ -+ level = nilfs_btree_node_get_level(node); -+ flags = nilfs_btree_node_get_flags(node); -+ nchildren = nilfs_btree_node_get_nchildren(node); -+ -+ if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || -+ level > NILFS_BTREE_LEVEL_MAX || -+ nchildren < 0 || -+ nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { -+ pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", -+ ino, level, flags, nchildren); -+ ret = 1; -+ } -+ return ret; -+} -+ - int nilfs_btree_broken_node_block(struct buffer_head *bh) - { - int ret; -@@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, - - /* convert and insert */ - dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; -- nilfs_btree_init(btree); -+ __nilfs_btree_init(btree); - if (nreq != NULL) { - nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); - nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); -@@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = { - .bop_gather_data = NULL, - }; - --int nilfs_btree_init(struct nilfs_bmap *bmap) -+static void __nilfs_btree_init(struct nilfs_bmap *bmap) - { - bmap->b_ops = &nilfs_btree_ops; - bmap->b_nchildren_per_block = - NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap)); -- return 0; -+} -+ -+int nilfs_btree_init(struct nilfs_bmap *bmap) -+{ -+ int ret = 0; -+ -+ __nilfs_btree_init(bmap); -+ -+ if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), -+ bmap->b_inode->i_ino)) -+ ret = -EIO; -+ return ret; - } - - void nilfs_btree_init_gc(struct nilfs_bmap *bmap) -diff --git a/fs/proc/generic.c b/fs/proc/generic.c -index b7f268eb5f45..2e2d9d5d78d9 100644 ---- a/fs/proc/generic.c -+++ b/fs/proc/generic.c -@@ -19,7 +19,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -162,17 +161,6 @@ void proc_free_inum(unsigned int inum) - spin_unlock_irqrestore(&proc_inum_lock, flags); - } - --static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) --{ -- nd_set_link(nd, __PDE_DATA(dentry->d_inode)); -- return NULL; --} -- --static const struct inode_operations proc_link_inode_operations = { -- .readlink = generic_readlink, -- .follow_link = proc_follow_link, --}; -- - /* - * Don't create negative dentries here, return -ENOENT by hand - * instead. -diff --git a/fs/proc/inode.c b/fs/proc/inode.c -index 124fc43c7090..2f2815f3176e 100644 ---- a/fs/proc/inode.c -+++ b/fs/proc/inode.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - #include - -@@ -401,6 +402,26 @@ static const struct file_operations proc_reg_file_ops_no_compat = { - }; - #endif - -+static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) -+{ -+ struct proc_dir_entry *pde = PDE(dentry->d_inode); -+ if (unlikely(!use_pde(pde))) -+ return ERR_PTR(-EINVAL); -+ nd_set_link(nd, pde->data); -+ return pde; -+} -+ -+static void proc_put_link(struct dentry *dentry, struct nameidata *nd, void *p) -+{ -+ unuse_pde(p); -+} -+ -+const struct inode_operations proc_link_inode_operations = { -+ .readlink = generic_readlink, -+ .follow_link = proc_follow_link, -+ .put_link = proc_put_link, -+}; -+ - struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) - { - struct inode *inode = new_inode_pseudo(sb); -diff --git a/fs/proc/internal.h b/fs/proc/internal.h -index 651d09a11dde..8b8ca1db6316 100644 ---- a/fs/proc/internal.h -+++ b/fs/proc/internal.h -@@ -202,6 +202,7 @@ struct pde_opener { - int closing; - struct completion *c; - }; -+extern const struct inode_operations proc_link_inode_operations; - - extern const struct inode_operations proc_pid_link_inode_operations; - -diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h -index 1772fadcff62..349325404add 100644 ---- a/include/target/target_core_base.h -+++ b/include/target/target_core_base.h -@@ -407,7 +407,7 @@ struct t10_reservation { - /* Activate Persistence across Target Power Loss enabled - * for SCSI device */ - int pr_aptpl_active; --#define PR_APTPL_BUF_LEN 8192 -+#define PR_APTPL_BUF_LEN 262144 - u32 pr_generation; - spinlock_t registration_lock; - spinlock_t aptpl_reg_lock; -diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h -index aece1346ceb7..4ad10baecd4d 100644 ---- a/include/trace/events/kmem.h -+++ b/include/trace/events/kmem.h -@@ -268,11 +268,11 @@ TRACE_EVENT(mm_page_alloc_extfrag, - - TP_PROTO(struct page *page, - int alloc_order, int fallback_order, -- int alloc_migratetype, int fallback_migratetype, int new_migratetype), -+ int alloc_migratetype, int fallback_migratetype), - - TP_ARGS(page, - alloc_order, fallback_order, -- alloc_migratetype, fallback_migratetype, new_migratetype), -+ alloc_migratetype, fallback_migratetype), - - TP_STRUCT__entry( - __field( struct page *, page ) -@@ -289,7 +289,8 @@ TRACE_EVENT(mm_page_alloc_extfrag, - __entry->fallback_order = fallback_order; - __entry->alloc_migratetype = alloc_migratetype; - __entry->fallback_migratetype = fallback_migratetype; -- __entry->change_ownership = (new_migratetype == alloc_migratetype); -+ __entry->change_ownership = (alloc_migratetype == -+ get_pageblock_migratetype(page)); - ), - - TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d", -diff --git a/mm/compaction.c b/mm/compaction.c -index 4229fc22a477..a522208bb8ea 100644 ---- a/mm/compaction.c -+++ b/mm/compaction.c -@@ -937,7 +937,7 @@ static int compact_finished(struct zone *zone, - return COMPACT_PARTIAL; - - /* Job done if allocation would set block type */ -- if (cc->order >= pageblock_order && area->nr_free) -+ if (order >= pageblock_order && area->nr_free) - return COMPACT_PARTIAL; - } - -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 472259b00618..c3e8660cb616 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -2488,9 +2488,10 @@ again: - goto unlock; - - /* -- * HWPoisoned hugepage is already unmapped and dropped reference -+ * Migrating hugepage or HWPoisoned hugepage is already -+ * unmapped and its refcount is dropped, so just clear pte here. - */ -- if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) { -+ if (unlikely(!pte_present(pte))) { - huge_pte_clear(mm, address, ptep); - goto unlock; - } -@@ -3163,7 +3164,26 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma, - spin_unlock(ptl); - continue; - } -- if (!huge_pte_none(huge_ptep_get(ptep))) { -+ pte = huge_ptep_get(ptep); -+ if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) { -+ spin_unlock(ptl); -+ continue; -+ } -+ if (unlikely(is_hugetlb_entry_migration(pte))) { -+ swp_entry_t entry = pte_to_swp_entry(pte); -+ -+ if (is_write_migration_entry(entry)) { -+ pte_t newpte; -+ -+ make_migration_entry_read(&entry); -+ newpte = swp_entry_to_pte(entry); -+ set_huge_pte_at(mm, address, ptep, newpte); -+ pages++; -+ } -+ spin_unlock(ptl); -+ continue; -+ } -+ if (!huge_pte_none(pte)) { - pte = huge_ptep_get_and_clear(mm, address, ptep); - pte = pte_mkhuge(huge_pte_modify(pte, newprot)); - pte = arch_make_huge_pte(pte, vma, NULL, 0); -diff --git a/mm/memory.c b/mm/memory.c -index 7f30beaba74f..102af096cbc5 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -4024,7 +4024,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, - if (follow_phys(vma, addr, write, &prot, &phys_addr)) - return -EINVAL; - -- maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot); -+ maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot); - if (write) - memcpy_toio(maddr + offset, buf, len); - else -diff --git a/mm/mmap.c b/mm/mmap.c -index 085bcd890ad2..d4c97ba6843b 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -129,7 +129,7 @@ EXPORT_SYMBOL_GPL(vm_memory_committed); - */ - int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - { -- unsigned long free, allowed, reserve; -+ long free, allowed, reserve; - - vm_acct_memory(pages); - -@@ -193,7 +193,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - */ - if (mm) { - reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); -- allowed -= min(mm->total_vm / 32, reserve); -+ allowed -= min_t(long, mm->total_vm / 32, reserve); - } - - if (percpu_counter_read_positive(&vm_committed_as) < allowed) -diff --git a/mm/nommu.c b/mm/nommu.c -index 3ee4f74fbfbe..76b3f90ada7b 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -1905,7 +1905,7 @@ EXPORT_SYMBOL(unmap_mapping_range); - */ - int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - { -- unsigned long free, allowed, reserve; -+ long free, allowed, reserve; - - vm_acct_memory(pages); - -@@ -1969,7 +1969,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - */ - if (mm) { - reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); -- allowed -= min(mm->total_vm / 32, reserve); -+ allowed -= min_t(long, mm->total_vm / 32, reserve); - } - - if (percpu_counter_read_positive(&vm_committed_as) < allowed) -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index ea419137f845..0479732f6b02 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -1081,8 +1081,8 @@ static void change_pageblock_range(struct page *pageblock_page, - * nor move CMA pages to different free lists. We don't want unmovable pages - * to be allocated from MIGRATE_CMA areas. - * -- * Returns the new migratetype of the pageblock (or the same old migratetype -- * if it was unchanged). -+ * Returns the allocation migratetype if free pages were stolen, or the -+ * fallback migratetype if it was decided not to steal. - */ - static int try_to_steal_freepages(struct zone *zone, struct page *page, - int start_type, int fallback_type) -@@ -1113,12 +1113,10 @@ static int try_to_steal_freepages(struct zone *zone, struct page *page, - - /* Claim the whole block if over half of it is free */ - if (pages >= (1 << (pageblock_order-1)) || -- page_group_by_mobility_disabled) { -- -+ page_group_by_mobility_disabled) - set_pageblock_migratetype(page, start_type); -- return start_type; -- } - -+ return start_type; - } - - return fallback_type; -@@ -1170,7 +1168,7 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype) - set_freepage_migratetype(page, new_type); - - trace_mm_page_alloc_extfrag(page, order, current_order, -- start_migratetype, migratetype, new_type); -+ start_migratetype, migratetype); - - return page; - } -diff --git a/net/compat.c b/net/compat.c -index cbc1a2a26587..275af79c131b 100644 ---- a/net/compat.c -+++ b/net/compat.c -@@ -738,24 +738,18 @@ static unsigned char nas[21] = { - - asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); - } - - asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, - unsigned int vlen, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, - flags | MSG_CMSG_COMPAT); - } - - asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); - } - -@@ -778,9 +772,6 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, - int datagrams; - struct timespec ktspec; - -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; -- - if (timeout == NULL) - return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, - flags | MSG_CMSG_COMPAT, NULL); -diff --git a/net/core/dev.c b/net/core/dev.c -index 4ed77d7245c0..f6d8d7fe29ab 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -940,7 +940,7 @@ bool dev_valid_name(const char *name) - return false; - - while (*name) { -- if (*name == '/' || isspace(*name)) -+ if (*name == '/' || *name == ':' || isspace(*name)) - return false; - name++; - } -diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c -index 9d3d9e78397b..372ac662adf9 100644 ---- a/net/core/gen_stats.c -+++ b/net/core/gen_stats.c -@@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) - return 0; - - nla_put_failure: -+ kfree(d->xstats); -+ d->xstats = NULL; -+ d->xstats_len = 0; - spin_unlock_bh(d->lock); - return -1; - } -@@ -217,7 +220,9 @@ int - gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) - { - if (d->compat_xstats) { -- d->xstats = st; -+ d->xstats = kmemdup(st, len, GFP_ATOMIC); -+ if (!d->xstats) -+ goto err_out; - d->xstats_len = len; - } - -@@ -225,6 +230,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) - return gnet_stats_copy(d, TCA_STATS_APP, st, len); - - return 0; -+ -+err_out: -+ d->xstats_len = 0; -+ spin_unlock_bh(d->lock); -+ return -1; - } - EXPORT_SYMBOL(gnet_stats_copy_app); - -@@ -257,6 +267,9 @@ gnet_stats_finish_copy(struct gnet_dump *d) - return -1; - } - -+ kfree(d->xstats); -+ d->xstats = NULL; -+ d->xstats_len = 0; - spin_unlock_bh(d->lock); - return 0; - } -diff --git a/net/core/pktgen.c b/net/core/pktgen.c -index fdac61cac1bd..ca68d32b49ba 100644 ---- a/net/core/pktgen.c -+++ b/net/core/pktgen.c -@@ -2812,25 +2812,25 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, - skb->dev = odev; - skb->pkt_type = PACKET_HOST; - -+ pktgen_finalize_skb(pkt_dev, skb, datalen); -+ - if (!(pkt_dev->flags & F_UDPCSUM)) { - skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & NETIF_F_V4_CSUM) { - skb->ip_summed = CHECKSUM_PARTIAL; - skb->csum = 0; -- udp4_hwcsum(skb, udph->source, udph->dest); -+ udp4_hwcsum(skb, iph->saddr, iph->daddr); - } else { -- __wsum csum = udp_csum(skb); -+ __wsum csum = skb_checksum(skb, skb_transport_offset(skb), datalen + 8, 0); - - /* add protocol-dependent pseudo-header */ -- udph->check = csum_tcpudp_magic(udph->source, udph->dest, -+ udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr, - datalen + 8, IPPROTO_UDP, csum); - - if (udph->check == 0) - udph->check = CSUM_MANGLED_0; - } - -- pktgen_finalize_skb(pkt_dev, skb, datalen); -- - #ifdef CONFIG_XFRM - if (!process_ipsec(pkt_dev, skb, protocol)) - return NULL; -@@ -2946,6 +2946,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, - skb->dev = odev; - skb->pkt_type = PACKET_HOST; - -+ pktgen_finalize_skb(pkt_dev, skb, datalen); -+ - if (!(pkt_dev->flags & F_UDPCSUM)) { - skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & NETIF_F_V6_CSUM) { -@@ -2954,7 +2956,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, - skb->csum_offset = offsetof(struct udphdr, check); - udph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, 0); - } else { -- __wsum csum = udp_csum(skb); -+ __wsum csum = skb_checksum(skb, skb_transport_offset(skb), udplen, 0); - - /* add protocol-dependent pseudo-header */ - udph->check = csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, csum); -@@ -2963,8 +2965,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, - udph->check = CSUM_MANGLED_0; - } - -- pktgen_finalize_skb(pkt_dev, skb, datalen); -- - return skb; - } - -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index a6613ff972c1..8aadd6a072a4 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -1264,14 +1264,10 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = { - }; - - static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { -- [IFLA_VF_MAC] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_mac) }, -- [IFLA_VF_VLAN] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_vlan) }, -- [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_tx_rate) }, -- [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_spoofchk) }, -+ [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, -+ [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, -+ [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) }, -+ [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) }, - }; - - static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { -@@ -2034,8 +2030,16 @@ replay: - } - } - err = rtnl_configure_link(dev, ifm); -- if (err < 0) -- unregister_netdevice(dev); -+ if (err < 0) { -+ if (ops->newlink) { -+ LIST_HEAD(list_kill); -+ -+ ops->dellink(dev, &list_kill); -+ unregister_netdevice_many(&list_kill); -+ } else { -+ unregister_netdevice(dev); -+ } -+ } - out: - put_net(dest_net); - return err; -diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c -index c10a3ce5cbff..9ff497d17545 100644 ---- a/net/ipv4/ip_fragment.c -+++ b/net/ipv4/ip_fragment.c -@@ -679,27 +679,30 @@ EXPORT_SYMBOL(ip_defrag); - struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) - { - struct iphdr iph; -+ int netoff; - u32 len; - - if (skb->protocol != htons(ETH_P_IP)) - return skb; - -- if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) -+ netoff = skb_network_offset(skb); -+ -+ if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0) - return skb; - - if (iph.ihl < 5 || iph.version != 4) - return skb; - - len = ntohs(iph.tot_len); -- if (skb->len < len || len < (iph.ihl * 4)) -+ if (skb->len < netoff + len || len < (iph.ihl * 4)) - return skb; - - if (ip_is_fragment(&iph)) { - skb = skb_share_check(skb, GFP_ATOMIC); - if (skb) { -- if (!pskb_may_pull(skb, iph.ihl*4)) -+ if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) - return skb; -- if (pskb_trim_rcsum(skb, len)) -+ if (pskb_trim_rcsum(skb, netoff + len)) - return skb; - memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); - if (ip_defrag(skb, user)) -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index dd637fc4b553..05686c47a289 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -843,7 +843,8 @@ static int __ip_append_data(struct sock *sk, - cork->length += length; - if (((length > mtu) || (skb && skb_is_gso(skb))) && - (sk->sk_protocol == IPPROTO_UDP) && -- (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { -+ (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && -+ (sk->sk_type == SOCK_DGRAM)) { - err = ip_ufo_append_data(sk, queue, getfrag, from, length, - hh_len, fragheaderlen, transhdrlen, - maxfraglen, flags); -diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c -index 04ce671430cb..b94002ab8052 100644 ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -259,6 +259,10 @@ int ping_init_sock(struct sock *sk) - kgid_t low, high; - int ret = 0; - -+#if IS_ENABLED(CONFIG_IPV6) -+ if (sk->sk_family == AF_INET6) -+ inet6_sk(sk)->ipv6only = 1; -+#endif - inet_get_ping_group_range_net(net, &low, &high); - if (gid_lte(low, group) && gid_lte(group, high)) - return 0; -@@ -305,6 +309,11 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk, - if (addr_len < sizeof(*addr)) - return -EINVAL; - -+ if (addr->sin_family != AF_INET && -+ !(addr->sin_family == AF_UNSPEC && -+ addr->sin_addr.s_addr == htonl(INADDR_ANY))) -+ return -EAFNOSUPPORT; -+ - pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n", - sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port)); - -@@ -330,7 +339,7 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk, - return -EINVAL; - - if (addr->sin6_family != AF_INET6) -- return -EINVAL; -+ return -EAFNOSUPPORT; - - pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n", - sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port)); -@@ -716,7 +725,7 @@ static int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m - if (msg->msg_namelen < sizeof(*usin)) - return -EINVAL; - if (usin->sin_family != AF_INET) -- return -EINVAL; -+ return -EAFNOSUPPORT; - daddr = usin->sin_addr.s_addr; - /* no remote port */ - } else { -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index 12f7ef0f243a..d7907ecf0b75 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -1294,7 +1294,8 @@ emsgsize: - if (((length > mtu) || - (skb && skb_is_gso(skb))) && - (sk->sk_protocol == IPPROTO_UDP) && -- (rt->dst.dev->features & NETIF_F_UFO)) { -+ (rt->dst.dev->features & NETIF_F_UFO) && -+ (sk->sk_type == SOCK_DGRAM)) { - err = ip6_ufo_append_data(sk, getfrag, from, length, - hh_len, fragheaderlen, - transhdrlen, mtu, flags, rt); -diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c -index bda74291c3e0..461199533fe4 100644 ---- a/net/ipv6/ping.c -+++ b/net/ipv6/ping.c -@@ -103,9 +103,10 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, - - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name); -- if (msg->msg_namelen < sizeof(struct sockaddr_in6) || -- u->sin6_family != AF_INET6) { -+ if (msg->msg_namelen < sizeof(*u)) - return -EINVAL; -+ if (u->sin6_family != AF_INET6) { -+ return -EAFNOSUPPORT; - } - if (sk->sk_bound_dev_if && - sk->sk_bound_dev_if != u->sin6_scope_id) { -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 6f1b8503a431..3809ca234c69 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) - u32 *p = NULL; - - if (!(rt->dst.flags & DST_HOST)) -- return NULL; -+ return dst_cow_metrics_generic(dst, old); - - peer = rt6_get_peer_create(rt); - if (peer) { -diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c -index 2ba8b9705bb7..fdcb9688b5d3 100644 ---- a/net/irda/ircomm/ircomm_tty.c -+++ b/net/irda/ircomm/ircomm_tty.c -@@ -818,7 +818,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) - orig_jiffies = jiffies; - - /* Set poll time to 200 ms */ -- poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); -+ poll_time = msecs_to_jiffies(200); -+ if (timeout) -+ poll_time = min_t(unsigned long, timeout, poll_time); - - spin_lock_irqsave(&self->spinlock, flags); - while (self->tx_skb && self->tx_skb->len) { -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index e5a7ac2f3687..dca076f6252c 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -562,6 +562,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) - if (tx->sdata->control_port_no_encrypt) - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO; -+ info->flags |= IEEE80211_TX_CTL_USE_MINRATE; - } - - return TX_CONTINUE; -diff --git a/net/sched/ematch.c b/net/sched/ematch.c -index 3a633debb6df..a2abc449ce8f 100644 ---- a/net/sched/ematch.c -+++ b/net/sched/ematch.c -@@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_proto *tp, - * to replay the request. - */ - module_put(em->ops->owner); -+ em->ops = NULL; - err = -EAGAIN; - } - #endif -diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c -index ae333c1845bb..0adc66caae2f 100644 ---- a/net/sunrpc/cache.c -+++ b/net/sunrpc/cache.c -@@ -920,7 +920,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait, - poll_wait(filp, &queue_wait, wait); - - /* alway allow write */ -- mask = POLL_OUT | POLLWRNORM; -+ mask = POLLOUT | POLLWRNORM; - - if (!rp) - return mask; -diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c -index 566b0f69d628..ee2405723188 100644 ---- a/sound/core/pcm_native.c -+++ b/sound/core/pcm_native.c -@@ -1404,6 +1404,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) - if (! snd_pcm_playback_empty(substream)) { - snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); - snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); -+ } else { -+ runtime->status->state = SNDRV_PCM_STATE_SETUP; - } - break; - case SNDRV_PCM_STATE_RUNNING: -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 103e85a13f35..2f3059b50ffa 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -3984,7 +3984,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, - /* Panther Point */ - { PCI_DEVICE(0x8086, 0x1e20), -- .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, - /* Lynx Point */ - { PCI_DEVICE(0x8086, 0x8c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 12f28d7e0fdc..231b26471a63 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -85,6 +85,7 @@ enum { - STAC_ALIENWARE_M17X, - STAC_92HD89XX_HP_FRONT_JACK, - STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, -+ STAC_92HD73XX_ASUS_MOBO, - STAC_92HD73XX_MODELS - }; - -@@ -1935,7 +1936,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { - [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { - .type = HDA_FIXUP_PINS, - .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, -- } -+ }, -+ [STAC_92HD73XX_ASUS_MOBO] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ /* enable 5.1 and SPDIF out */ -+ { 0x0c, 0x01014411 }, -+ { 0x0d, 0x01014410 }, -+ { 0x0e, 0x01014412 }, -+ { 0x22, 0x014b1180 }, -+ { } -+ } -+ }, - }; - - static const struct hda_model_fixup stac92hd73xx_models[] = { -@@ -1947,6 +1959,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { - { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, - { .id = STAC_DELL_EQ, .name = "dell-eq" }, - { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, -+ { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, - {} - }; - -@@ -1999,6 +2012,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { - "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, - "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), -+ SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10", -+ STAC_92HD73XX_ASUS_MOBO), - {} /* terminator */ - }; - -diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c -index 07b8b7bc9d20..81f6a7545ef5 100644 ---- a/sound/soc/omap/omap-pcm.c -+++ b/sound/soc/omap/omap-pcm.c -@@ -200,7 +200,7 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) - struct snd_pcm *pcm = rtd->pcm; - int ret; - -- ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(64)); -+ ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - diff --git a/patch/kernel/neo-patch-3.14.36-37 b/patch/kernel/neo-patch-3.14.36-37 deleted file mode 100644 index 6b928d9ec..000000000 --- a/patch/kernel/neo-patch-3.14.36-37 +++ /dev/null @@ -1,2861 +0,0 @@ -diff --git a/Makefile b/Makefile -index 4e6537bd8aa0..c24acc0d34a1 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 36 -+SUBLEVEL = 37 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi -index e96da9a898ad..f2512e1d28c7 100644 ---- a/arch/arm/boot/dts/dra7xx-clocks.dtsi -+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi -@@ -243,10 +243,18 @@ - ti,invert-autoidle-bit; - }; - -+ dpll_core_byp_mux: dpll_core_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ ti,bit-shift = <23>; -+ reg = <0x012c>; -+ }; -+ - dpll_core_ck: dpll_core_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-core-clock"; -- clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ clocks = <&sys_clkin1>, <&dpll_core_byp_mux>; - reg = <0x0120>, <0x0124>, <0x012c>, <0x0128>; - }; - -@@ -309,10 +317,18 @@ - clock-div = <1>; - }; - -+ dpll_dsp_byp_mux: dpll_dsp_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&dsp_dpll_hs_clk_div>; -+ ti,bit-shift = <23>; -+ reg = <0x0240>; -+ }; -+ - dpll_dsp_ck: dpll_dsp_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&dsp_dpll_hs_clk_div>; -+ clocks = <&sys_clkin1>, <&dpll_dsp_byp_mux>; - reg = <0x0234>, <0x0238>, <0x0240>, <0x023c>; - }; - -@@ -335,10 +351,18 @@ - clock-div = <1>; - }; - -+ dpll_iva_byp_mux: dpll_iva_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&iva_dpll_hs_clk_div>; -+ ti,bit-shift = <23>; -+ reg = <0x01ac>; -+ }; -+ - dpll_iva_ck: dpll_iva_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&iva_dpll_hs_clk_div>; -+ clocks = <&sys_clkin1>, <&dpll_iva_byp_mux>; - reg = <0x01a0>, <0x01a4>, <0x01ac>, <0x01a8>; - }; - -@@ -361,10 +385,18 @@ - clock-div = <1>; - }; - -+ dpll_gpu_byp_mux: dpll_gpu_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ ti,bit-shift = <23>; -+ reg = <0x02e4>; -+ }; -+ - dpll_gpu_ck: dpll_gpu_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ clocks = <&sys_clkin1>, <&dpll_gpu_byp_mux>; - reg = <0x02d8>, <0x02dc>, <0x02e4>, <0x02e0>; - }; - -@@ -398,10 +430,18 @@ - clock-div = <1>; - }; - -+ dpll_ddr_byp_mux: dpll_ddr_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ ti,bit-shift = <23>; -+ reg = <0x021c>; -+ }; -+ - dpll_ddr_ck: dpll_ddr_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ clocks = <&sys_clkin1>, <&dpll_ddr_byp_mux>; - reg = <0x0210>, <0x0214>, <0x021c>, <0x0218>; - }; - -@@ -416,10 +456,18 @@ - ti,invert-autoidle-bit; - }; - -+ dpll_gmac_byp_mux: dpll_gmac_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ ti,bit-shift = <23>; -+ reg = <0x02b4>; -+ }; -+ - dpll_gmac_ck: dpll_gmac_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>; -+ clocks = <&sys_clkin1>, <&dpll_gmac_byp_mux>; - reg = <0x02a8>, <0x02ac>, <0x02b4>, <0x02b0>; - }; - -@@ -482,10 +530,18 @@ - clock-div = <1>; - }; - -+ dpll_eve_byp_mux: dpll_eve_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&eve_dpll_hs_clk_div>; -+ ti,bit-shift = <23>; -+ reg = <0x0290>; -+ }; -+ - dpll_eve_ck: dpll_eve_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&eve_dpll_hs_clk_div>; -+ clocks = <&sys_clkin1>, <&dpll_eve_byp_mux>; - reg = <0x0284>, <0x0288>, <0x0290>, <0x028c>; - }; - -@@ -1214,10 +1270,18 @@ - clock-div = <1>; - }; - -+ dpll_per_byp_mux: dpll_per_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&per_dpll_hs_clk_div>; -+ ti,bit-shift = <23>; -+ reg = <0x014c>; -+ }; -+ - dpll_per_ck: dpll_per_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-clock"; -- clocks = <&sys_clkin1>, <&per_dpll_hs_clk_div>; -+ clocks = <&sys_clkin1>, <&dpll_per_byp_mux>; - reg = <0x0140>, <0x0144>, <0x014c>, <0x0148>; - }; - -@@ -1240,10 +1304,18 @@ - clock-div = <1>; - }; - -+ dpll_usb_byp_mux: dpll_usb_byp_mux { -+ #clock-cells = <0>; -+ compatible = "ti,mux-clock"; -+ clocks = <&sys_clkin1>, <&usb_dpll_hs_clk_div>; -+ ti,bit-shift = <23>; -+ reg = <0x018c>; -+ }; -+ - dpll_usb_ck: dpll_usb_ck { - #clock-cells = <0>; - compatible = "ti,omap4-dpll-j-type-clock"; -- clocks = <&sys_clkin1>, <&usb_dpll_hs_clk_div>; -+ clocks = <&sys_clkin1>, <&dpll_usb_byp_mux>; - reg = <0x0180>, <0x0184>, <0x018c>, <0x0188>; - }; - -diff --git a/arch/arm/crypto/aesbs-core.S_shipped b/arch/arm/crypto/aesbs-core.S_shipped -index 71e5fc7cfb18..1d1800f71c5b 100644 ---- a/arch/arm/crypto/aesbs-core.S_shipped -+++ b/arch/arm/crypto/aesbs-core.S_shipped -@@ -58,14 +58,18 @@ - # define VFP_ABI_FRAME 0 - # define BSAES_ASM_EXTENDED_KEY - # define XTS_CHAIN_TWEAK --# define __ARM_ARCH__ 7 -+# define __ARM_ARCH__ __LINUX_ARM_ARCH__ -+# define __ARM_MAX_ARCH__ 7 - #endif - - #ifdef __thumb__ - # define adrl adr - #endif - --#if __ARM_ARCH__>=7 -+#if __ARM_MAX_ARCH__>=7 -+.arch armv7-a -+.fpu neon -+ - .text - .syntax unified @ ARMv7-capable assembler is expected to handle this - #ifdef __thumb2__ -@@ -74,8 +78,6 @@ - .code 32 - #endif - --.fpu neon -- - .type _bsaes_decrypt8,%function - .align 4 - _bsaes_decrypt8: -@@ -2095,9 +2097,11 @@ bsaes_xts_decrypt: - vld1.8 {q8}, [r0] @ initial tweak - adr r2, .Lxts_magic - -+#ifndef XTS_CHAIN_TWEAK - tst r9, #0xf @ if not multiple of 16 - it ne @ Thumb2 thing, sanity check in ARM - subne r9, #0x10 @ subtract another 16 bytes -+#endif - subs r9, #0x80 - - blo .Lxts_dec_short -diff --git a/arch/arm/crypto/bsaes-armv7.pl b/arch/arm/crypto/bsaes-armv7.pl -index be068db960ee..a4d3856e7d24 100644 ---- a/arch/arm/crypto/bsaes-armv7.pl -+++ b/arch/arm/crypto/bsaes-armv7.pl -@@ -701,14 +701,18 @@ $code.=<<___; - # define VFP_ABI_FRAME 0 - # define BSAES_ASM_EXTENDED_KEY - # define XTS_CHAIN_TWEAK --# define __ARM_ARCH__ 7 -+# define __ARM_ARCH__ __LINUX_ARM_ARCH__ -+# define __ARM_MAX_ARCH__ 7 - #endif - - #ifdef __thumb__ - # define adrl adr - #endif - --#if __ARM_ARCH__>=7 -+#if __ARM_MAX_ARCH__>=7 -+.arch armv7-a -+.fpu neon -+ - .text - .syntax unified @ ARMv7-capable assembler is expected to handle this - #ifdef __thumb2__ -@@ -717,8 +721,6 @@ $code.=<<___; - .code 32 - #endif - --.fpu neon -- - .type _bsaes_decrypt8,%function - .align 4 - _bsaes_decrypt8: -@@ -2076,9 +2078,11 @@ bsaes_xts_decrypt: - vld1.8 {@XMM[8]}, [r0] @ initial tweak - adr $magic, .Lxts_magic - -+#ifndef XTS_CHAIN_TWEAK - tst $len, #0xf @ if not multiple of 16 - it ne @ Thumb2 thing, sanity check in ARM - subne $len, #0x10 @ subtract another 16 bytes -+#endif - subs $len, #0x80 - - blo .Lxts_dec_short -diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h -index c5101dcb4fb0..1d4df3b70ebc 100644 ---- a/arch/arm/mach-at91/pm.h -+++ b/arch/arm/mach-at91/pm.h -@@ -45,7 +45,7 @@ static inline void at91rm9200_standby(void) - " mcr p15, 0, %0, c7, c0, 4\n\t" - " str %5, [%1, %2]" - : -- : "r" (0), "r" (AT91_BASE_SYS), "r" (AT91RM9200_SDRAMC_LPR), -+ : "r" (0), "r" (at91_ramc_base[0]), "r" (AT91RM9200_SDRAMC_LPR), - "r" (1), "r" (AT91RM9200_SDRAMC_SRR), - "r" (lpr)); - } -diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c -index fbd76785c5db..3974881388bb 100644 ---- a/arch/arm64/mm/dma-mapping.c -+++ b/arch/arm64/mm/dma-mapping.c -@@ -44,6 +44,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size, - flags |= GFP_DMA32; - if (IS_ENABLED(CONFIG_DMA_CMA)) { - struct page *page; -+ void *addr; - - size = PAGE_ALIGN(size); - page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, -@@ -52,7 +53,10 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size, - return NULL; - - *dma_handle = phys_to_dma(dev, page_to_phys(page)); -- return page_address(page); -+ addr = page_address(page); -+ if (flags & __GFP_ZERO) -+ memset(addr, 0, size); -+ return addr; - } else { - return swiotlb_alloc_coherent(dev, size, dma_handle, flags); - } -diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c -index 617b9fe33771..3ccb6777a7e1 100644 ---- a/arch/sparc/kernel/perf_event.c -+++ b/arch/sparc/kernel/perf_event.c -@@ -960,6 +960,8 @@ out: - cpuc->pcr[0] |= cpuc->event[0]->hw.config_base; - } - -+static void sparc_pmu_start(struct perf_event *event, int flags); -+ - /* On this PMU each PIC has it's own PCR control register. */ - static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) - { -@@ -972,20 +974,13 @@ static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) - struct perf_event *cp = cpuc->event[i]; - struct hw_perf_event *hwc = &cp->hw; - int idx = hwc->idx; -- u64 enc; - - if (cpuc->current_idx[i] != PIC_NO_INDEX) - continue; - -- sparc_perf_event_set_period(cp, hwc, idx); - cpuc->current_idx[i] = idx; - -- enc = perf_event_get_enc(cpuc->events[i]); -- cpuc->pcr[idx] &= ~mask_for_index(idx); -- if (hwc->state & PERF_HES_STOPPED) -- cpuc->pcr[idx] |= nop_for_index(idx); -- else -- cpuc->pcr[idx] |= event_encoding(enc, idx); -+ sparc_pmu_start(cp, PERF_EF_RELOAD); - } - out: - for (i = 0; i < cpuc->n_events; i++) { -@@ -1101,7 +1096,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags) - int i; - - local_irq_save(flags); -- perf_pmu_disable(event->pmu); - - for (i = 0; i < cpuc->n_events; i++) { - if (event == cpuc->event[i]) { -@@ -1127,7 +1121,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags) - } - } - -- perf_pmu_enable(event->pmu); - local_irq_restore(flags); - } - -@@ -1361,7 +1354,6 @@ static int sparc_pmu_add(struct perf_event *event, int ef_flags) - unsigned long flags; - - local_irq_save(flags); -- perf_pmu_disable(event->pmu); - - n0 = cpuc->n_events; - if (n0 >= sparc_pmu->max_hw_events) -@@ -1394,7 +1386,6 @@ nocheck: - - ret = 0; - out: -- perf_pmu_enable(event->pmu); - local_irq_restore(flags); - return ret; - } -diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c -index c6f7113b6e2f..1a79d6877981 100644 ---- a/arch/sparc/kernel/process_64.c -+++ b/arch/sparc/kernel/process_64.c -@@ -281,6 +281,8 @@ void arch_trigger_all_cpu_backtrace(void) - printk(" TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n", - gp->tpc, gp->o7, gp->i7, gp->rpc); - } -+ -+ touch_nmi_watchdog(); - } - - memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); -@@ -356,6 +358,8 @@ static void pmu_snapshot_all_cpus(void) - (cpu == this_cpu ? '*' : ' '), cpu, - pp->pcr[0], pp->pcr[1], pp->pcr[2], pp->pcr[3], - pp->pic[0], pp->pic[1], pp->pic[2], pp->pic[3]); -+ -+ touch_nmi_watchdog(); - } - - memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c -index beb0b5a5f21f..25db14a33d03 100644 ---- a/arch/sparc/kernel/sys_sparc_64.c -+++ b/arch/sparc/kernel/sys_sparc_64.c -@@ -332,7 +332,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second - long err; - - /* No need for backward compatibility. We can start fresh... */ -- if (call <= SEMCTL) { -+ if (call <= SEMTIMEDOP) { - switch (call) { - case SEMOP: - err = sys_semtimedop(first, ptr, -diff --git a/arch/sparc/lib/memmove.S b/arch/sparc/lib/memmove.S -index b7f6334e159f..857ad4f8905f 100644 ---- a/arch/sparc/lib/memmove.S -+++ b/arch/sparc/lib/memmove.S -@@ -8,9 +8,11 @@ - - .text - ENTRY(memmove) /* o0=dst o1=src o2=len */ -- mov %o0, %g1 -+ brz,pn %o2, 99f -+ mov %o0, %g1 -+ - cmp %o0, %o1 -- bleu,pt %xcc, memcpy -+ bleu,pt %xcc, 2f - add %o1, %o2, %g7 - cmp %g7, %o0 - bleu,pt %xcc, memcpy -@@ -24,7 +26,34 @@ ENTRY(memmove) /* o0=dst o1=src o2=len */ - stb %g7, [%o0] - bne,pt %icc, 1b - sub %o0, 1, %o0 -- -+99: - retl - mov %g1, %o0 -+ -+ /* We can't just call memcpy for these memmove cases. On some -+ * chips the memcpy uses cache initializing stores and when dst -+ * and src are close enough, those can clobber the source data -+ * before we've loaded it in. -+ */ -+2: or %o0, %o1, %g7 -+ or %o2, %g7, %g7 -+ andcc %g7, 0x7, %g0 -+ bne,pn %xcc, 4f -+ nop -+ -+3: ldx [%o1], %g7 -+ add %o1, 8, %o1 -+ subcc %o2, 8, %o2 -+ add %o0, 8, %o0 -+ bne,pt %icc, 3b -+ stx %g7, [%o0 - 0x8] -+ ba,a,pt %xcc, 99b -+ -+4: ldub [%o1], %g7 -+ add %o1, 1, %o1 -+ subcc %o2, 1, %o2 -+ add %o0, 1, %o0 -+ bne,pt %icc, 4b -+ stb %g7, [%o0 - 0x1] -+ ba,a,pt %xcc, 99b - ENDPROC(memmove) -diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c -index cfbe53c17b0d..09daebdee552 100644 ---- a/arch/sparc/mm/srmmu.c -+++ b/arch/sparc/mm/srmmu.c -@@ -460,10 +460,12 @@ static void __init sparc_context_init(int numctx) - void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, - struct task_struct *tsk) - { -+ unsigned long flags; -+ - if (mm->context == NO_CONTEXT) { -- spin_lock(&srmmu_context_spinlock); -+ spin_lock_irqsave(&srmmu_context_spinlock, flags); - alloc_context(old_mm, mm); -- spin_unlock(&srmmu_context_spinlock); -+ spin_unlock_irqrestore(&srmmu_context_spinlock, flags); - srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd); - } - -@@ -988,14 +990,15 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) - - void destroy_context(struct mm_struct *mm) - { -+ unsigned long flags; - - if (mm->context != NO_CONTEXT) { - flush_cache_mm(mm); - srmmu_ctxd_set(&srmmu_context_table[mm->context], srmmu_swapper_pg_dir); - flush_tlb_mm(mm); -- spin_lock(&srmmu_context_spinlock); -+ spin_lock_irqsave(&srmmu_context_spinlock, flags); - free_context(mm->context); -- spin_unlock(&srmmu_context_spinlock); -+ spin_unlock_irqrestore(&srmmu_context_spinlock, flags); - mm->context = NO_CONTEXT; - } - } -diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c -index 6dfb7d0b139a..6d4fabac779c 100644 ---- a/arch/x86/crypto/aesni-intel_glue.c -+++ b/arch/x86/crypto/aesni-intel_glue.c -@@ -1109,7 +1109,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) - src = kmalloc(req->cryptlen + req->assoclen, GFP_ATOMIC); - if (!src) - return -ENOMEM; -- assoc = (src + req->cryptlen + auth_tag_len); -+ assoc = (src + req->cryptlen); - scatterwalk_map_and_copy(src, req->src, 0, req->cryptlen, 0); - scatterwalk_map_and_copy(assoc, req->assoc, 0, - req->assoclen, 0); -@@ -1134,7 +1134,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) - scatterwalk_done(&src_sg_walk, 0, 0); - scatterwalk_done(&assoc_sg_walk, 0, 0); - } else { -- scatterwalk_map_and_copy(dst, req->dst, 0, req->cryptlen, 1); -+ scatterwalk_map_and_copy(dst, req->dst, 0, tempCipherLen, 1); - kfree(src); - } - return retval; -diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h -index cea1c76d49bf..1ac1c009090d 100644 ---- a/arch/x86/include/asm/fpu-internal.h -+++ b/arch/x86/include/asm/fpu-internal.h -@@ -368,7 +368,7 @@ static inline void drop_fpu(struct task_struct *tsk) - preempt_disable(); - tsk->thread.fpu_counter = 0; - __drop_fpu(tsk); -- clear_used_math(); -+ clear_stopped_child_used_math(tsk); - preempt_enable(); - } - -diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c -index dd50e26c58f6..7a09aca4b33a 100644 ---- a/arch/x86/kernel/xsave.c -+++ b/arch/x86/kernel/xsave.c -@@ -375,7 +375,7 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) - * thread's fpu state, reconstruct fxstate from the fsave - * header. Sanitize the copied state etc. - */ -- struct xsave_struct *xsave = &tsk->thread.fpu.state->xsave; -+ struct fpu *fpu = &tsk->thread.fpu; - struct user_i387_ia32_struct env; - int err = 0; - -@@ -389,14 +389,15 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) - */ - drop_fpu(tsk); - -- if (__copy_from_user(xsave, buf_fx, state_size) || -+ if (__copy_from_user(&fpu->state->xsave, buf_fx, state_size) || - __copy_from_user(&env, buf, sizeof(env))) { -+ fpu_finit(fpu); - err = -1; - } else { - sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only); -- set_used_math(); - } - -+ set_used_math(); - if (use_eager_fpu()) { - preempt_disable(); - math_state_restore(); -diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S -index 31776d0efc8c..d7ec4e251c0a 100644 ---- a/arch/x86/vdso/vdso32/sigreturn.S -+++ b/arch/x86/vdso/vdso32/sigreturn.S -@@ -17,6 +17,7 @@ - .text - .globl __kernel_sigreturn - .type __kernel_sigreturn,@function -+ nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */ - ALIGN - __kernel_sigreturn: - .LSTART_sigreturn: -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index eff9d5870034..102463ba745d 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -124,7 +124,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) - { - struct ibmvtpm_dev *ibmvtpm; - struct ibmvtpm_crq crq; -- u64 *word = (u64 *) &crq; -+ __be64 *word = (__be64 *)&crq; - int rc; - - ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip); -@@ -145,11 +145,11 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) - memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_TPM_COMMAND; -- crq.len = (u16)count; -- crq.data = ibmvtpm->rtce_dma_handle; -+ crq.len = cpu_to_be16(count); -+ crq.data = cpu_to_be32(ibmvtpm->rtce_dma_handle); - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), -- cpu_to_be64(word[1])); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]), -+ be64_to_cpu(word[1])); - if (rc != H_SUCCESS) { - dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); - rc = 0; -diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h -index bd82a791f995..b2c231b1beec 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.h -+++ b/drivers/char/tpm/tpm_ibmvtpm.h -@@ -22,9 +22,9 @@ - struct ibmvtpm_crq { - u8 valid; - u8 msg; -- u16 len; -- u32 data; -- u64 reserved; -+ __be16 len; -+ __be32 data; -+ __be64 reserved; - } __attribute__((packed, aligned(8))); - - struct ibmvtpm_crq_queue { -diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c -index 6928d094451d..b08eadb4b1d2 100644 ---- a/drivers/char/virtio_console.c -+++ b/drivers/char/virtio_console.c -@@ -142,6 +142,7 @@ struct ports_device { - * notification - */ - struct work_struct control_work; -+ struct work_struct config_work; - - struct list_head ports; - -@@ -1832,10 +1833,21 @@ static void config_intr(struct virtio_device *vdev) - - portdev = vdev->priv; - -+ if (!use_multiport(portdev)) -+ schedule_work(&portdev->config_work); -+} -+ -+static void config_work_handler(struct work_struct *work) -+{ -+ struct ports_device *portdev; -+ -+ portdev = container_of(work, struct ports_device, control_work); - if (!use_multiport(portdev)) { -+ struct virtio_device *vdev; - struct port *port; - u16 rows, cols; - -+ vdev = portdev->vdev; - virtio_cread(vdev, struct virtio_console_config, cols, &cols); - virtio_cread(vdev, struct virtio_console_config, rows, &rows); - -@@ -2024,12 +2036,14 @@ static int virtcons_probe(struct virtio_device *vdev) - spin_lock_init(&portdev->ports_lock); - INIT_LIST_HEAD(&portdev->ports); - -+ INIT_WORK(&portdev->config_work, &config_work_handler); -+ INIT_WORK(&portdev->control_work, &control_work_handler); -+ - if (multiport) { - unsigned int nr_added_bufs; - - spin_lock_init(&portdev->c_ivq_lock); - spin_lock_init(&portdev->c_ovq_lock); -- INIT_WORK(&portdev->control_work, &control_work_handler); - - nr_added_bufs = fill_queue(portdev->c_ivq, - &portdev->c_ivq_lock); -@@ -2097,6 +2111,8 @@ static void virtcons_remove(struct virtio_device *vdev) - /* Finish up work that's lined up */ - if (use_multiport(portdev)) - cancel_work_sync(&portdev->control_work); -+ else -+ cancel_work_sync(&portdev->config_work); - - list_for_each_entry_safe(port, port2, &portdev->ports, list) - unplug_port(port); -@@ -2148,6 +2164,7 @@ static int virtcons_freeze(struct virtio_device *vdev) - - virtqueue_disable_cb(portdev->c_ivq); - cancel_work_sync(&portdev->control_work); -+ cancel_work_sync(&portdev->config_work); - /* - * Once more: if control_work_handler() was running, it would - * enable the cb as the last step. -diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c -index 0cca5f24196a..663394f0c166 100644 ---- a/drivers/gpu/drm/radeon/atombios_crtc.c -+++ b/drivers/gpu/drm/radeon/atombios_crtc.c -@@ -1306,6 +1306,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, - (x << 16) | y); - viewport_w = crtc->mode.hdisplay; - viewport_h = (crtc->mode.vdisplay + 1) & ~1; -+ if ((rdev->family >= CHIP_BONAIRE) && -+ (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)) -+ viewport_h *= 2; - WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, - (viewport_w << 16) | viewport_h); - -diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c -index f0ed0baddf70..c3664bc05acf 100644 ---- a/drivers/gpu/drm/radeon/cik.c -+++ b/drivers/gpu/drm/radeon/cik.c -@@ -7069,6 +7069,9 @@ int cik_irq_set(struct radeon_device *rdev) - WREG32(DC_HPD5_INT_CONTROL, hpd5); - WREG32(DC_HPD6_INT_CONTROL, hpd6); - -+ /* posting read */ -+ RREG32(SRBM_STATUS); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c -index 7138f3e31b7c..ee9f0b4e90d6 100644 ---- a/drivers/gpu/drm/radeon/evergreen.c -+++ b/drivers/gpu/drm/radeon/evergreen.c -@@ -4596,6 +4596,9 @@ int evergreen_irq_set(struct radeon_device *rdev) - WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, afmt5); - WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, afmt6); - -+ /* posting read */ -+ RREG32(SRBM_STATUS); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c -index 07620e198a6d..e28de20d469a 100644 ---- a/drivers/gpu/drm/radeon/r100.c -+++ b/drivers/gpu/drm/radeon/r100.c -@@ -742,6 +742,10 @@ int r100_irq_set(struct radeon_device *rdev) - tmp |= RADEON_FP2_DETECT_MASK; - } - WREG32(RADEON_GEN_INT_CNTL, tmp); -+ -+ /* read back to post the write */ -+ RREG32(RADEON_GEN_INT_CNTL); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c -index 788f602e8989..74a8a38db4d5 100644 ---- a/drivers/gpu/drm/radeon/r600.c -+++ b/drivers/gpu/drm/radeon/r600.c -@@ -3647,6 +3647,9 @@ int r600_irq_set(struct radeon_device *rdev) - WREG32(RV770_CG_THERMAL_INT, thermal_int); - } - -+ /* posting read */ -+ RREG32(R_000E50_SRBM_STATUS); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c -index 7f2d6c0d11c1..2f2d2ce34709 100644 ---- a/drivers/gpu/drm/radeon/radeon_cs.c -+++ b/drivers/gpu/drm/radeon/radeon_cs.c -@@ -179,11 +179,13 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) - u32 ring = RADEON_CS_RING_GFX; - s32 priority = 0; - -+ INIT_LIST_HEAD(&p->validated); -+ - if (!cs->num_chunks) { - return 0; - } -+ - /* get chunks */ -- INIT_LIST_HEAD(&p->validated); - p->idx = 0; - p->ib.sa_bo = NULL; - p->ib.semaphore = NULL; -diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c -index e5619d5e2a30..4261b3865cb0 100644 ---- a/drivers/gpu/drm/radeon/rs600.c -+++ b/drivers/gpu/drm/radeon/rs600.c -@@ -700,6 +700,10 @@ int rs600_irq_set(struct radeon_device *rdev) - WREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL, hpd2); - if (ASIC_IS_DCE2(rdev)) - WREG32(R_007408_HDMI0_AUDIO_PACKET_CONTROL, hdmi0); -+ -+ /* posting read */ -+ RREG32(R_000040_GEN_INT_CNTL); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c -index 52b64ad285d6..2f2deccb3b78 100644 ---- a/drivers/gpu/drm/radeon/si.c -+++ b/drivers/gpu/drm/radeon/si.c -@@ -5958,6 +5958,9 @@ int si_irq_set(struct radeon_device *rdev) - - WREG32(CG_THERMAL_INT, thermal_int); - -+ /* posting read */ -+ RREG32(SRBM_STATUS); -+ - return 0; - } - -@@ -6875,8 +6878,7 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) - WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_BYPASS_EN_MASK, ~UPLL_BYPASS_EN_MASK); - - if (!vclk || !dclk) { -- /* keep the Bypass mode, put PLL to sleep */ -- WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_SLEEP_MASK, ~UPLL_SLEEP_MASK); -+ /* keep the Bypass mode */ - return 0; - } - -@@ -6892,8 +6894,7 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) - /* set VCO_MODE to 1 */ - WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_VCO_MODE_MASK, ~UPLL_VCO_MODE_MASK); - -- /* toggle UPLL_SLEEP to 1 then back to 0 */ -- WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_SLEEP_MASK, ~UPLL_SLEEP_MASK); -+ /* disable sleep mode */ - WREG32_P(CG_UPLL_FUNC_CNTL, 0, ~UPLL_SLEEP_MASK); - - /* deassert UPLL_RESET */ -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -index fb7c36e93fd4..0771dcbf9ed0 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -@@ -733,32 +733,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) - goto out_err1; - } - -- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, -- (dev_priv->vram_size >> PAGE_SHIFT)); -- if (unlikely(ret != 0)) { -- DRM_ERROR("Failed initializing memory manager for VRAM.\n"); -- goto out_err2; -- } -- -- dev_priv->has_gmr = true; -- if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) || -- refuse_dma || ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_GMR, -- VMW_PL_GMR) != 0) { -- DRM_INFO("No GMR memory available. " -- "Graphics memory resources are very limited.\n"); -- dev_priv->has_gmr = false; -- } -- -- if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { -- dev_priv->has_mob = true; -- if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB, -- VMW_PL_MOB) != 0) { -- DRM_INFO("No MOB memory available. " -- "3D will be disabled.\n"); -- dev_priv->has_mob = false; -- } -- } -- - dev_priv->mmio_mtrr = arch_phys_wc_add(dev_priv->mmio_start, - dev_priv->mmio_size); - -@@ -821,6 +795,33 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) - goto out_no_fman; - } - -+ -+ ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, -+ (dev_priv->vram_size >> PAGE_SHIFT)); -+ if (unlikely(ret != 0)) { -+ DRM_ERROR("Failed initializing memory manager for VRAM.\n"); -+ goto out_no_vram; -+ } -+ -+ dev_priv->has_gmr = true; -+ if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) || -+ refuse_dma || ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_GMR, -+ VMW_PL_GMR) != 0) { -+ DRM_INFO("No GMR memory available. " -+ "Graphics memory resources are very limited.\n"); -+ dev_priv->has_gmr = false; -+ } -+ -+ if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { -+ dev_priv->has_mob = true; -+ if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB, -+ VMW_PL_MOB) != 0) { -+ DRM_INFO("No MOB memory available. " -+ "3D will be disabled.\n"); -+ dev_priv->has_mob = false; -+ } -+ } -+ - vmw_kms_save_vga(dev_priv); - - /* Start kms and overlay systems, needs fifo. */ -@@ -846,6 +847,12 @@ out_no_fifo: - vmw_kms_close(dev_priv); - out_no_kms: - vmw_kms_restore_vga(dev_priv); -+ if (dev_priv->has_mob) -+ (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); -+ if (dev_priv->has_gmr) -+ (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); -+ (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); -+out_no_vram: - vmw_fence_manager_takedown(dev_priv->fman); - out_no_fman: - if (dev_priv->capabilities & SVGA_CAP_IRQMASK) -@@ -861,12 +868,6 @@ out_err4: - iounmap(dev_priv->mmio_virt); - out_err3: - arch_phys_wc_del(dev_priv->mmio_mtrr); -- if (dev_priv->has_mob) -- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); -- if (dev_priv->has_gmr) -- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); -- (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); --out_err2: - (void)ttm_bo_device_release(&dev_priv->bdev); - out_err1: - vmw_ttm_global_release(dev_priv); -@@ -896,6 +897,13 @@ static int vmw_driver_unload(struct drm_device *dev) - } - vmw_kms_close(dev_priv); - vmw_overlay_close(dev_priv); -+ -+ if (dev_priv->has_mob) -+ (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); -+ if (dev_priv->has_gmr) -+ (void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); -+ (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); -+ - vmw_fence_manager_takedown(dev_priv->fman); - if (dev_priv->capabilities & SVGA_CAP_IRQMASK) - drm_irq_uninstall(dev_priv->dev); -@@ -907,11 +915,6 @@ static int vmw_driver_unload(struct drm_device *dev) - ttm_object_device_release(&dev_priv->tdev); - iounmap(dev_priv->mmio_virt); - arch_phys_wc_del(dev_priv->mmio_mtrr); -- if (dev_priv->has_mob) -- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); -- if (dev_priv->has_gmr) -- (void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); -- (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); - (void)ttm_bo_device_release(&dev_priv->bdev); - vmw_ttm_global_release(dev_priv); - -diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c -index 51e15fd53108..d058b00ba218 100644 ---- a/drivers/mtd/nand/pxa3xx_nand.c -+++ b/drivers/mtd/nand/pxa3xx_nand.c -@@ -481,6 +481,42 @@ static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask) - nand_writel(info, NDCR, ndcr | int_mask); - } - -+static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len) -+{ -+ if (info->ecc_bch) { -+ int timeout; -+ -+ /* -+ * According to the datasheet, when reading from NDDB -+ * with BCH enabled, after each 32 bytes reads, we -+ * have to make sure that the NDSR.RDDREQ bit is set. -+ * -+ * Drain the FIFO 8 32 bits reads at a time, and skip -+ * the polling on the last read. -+ */ -+ while (len > 8) { -+ __raw_readsl(info->mmio_base + NDDB, data, 8); -+ -+ for (timeout = 0; -+ !(nand_readl(info, NDSR) & NDSR_RDDREQ); -+ timeout++) { -+ if (timeout >= 5) { -+ dev_err(&info->pdev->dev, -+ "Timeout on RDDREQ while draining the FIFO\n"); -+ return; -+ } -+ -+ mdelay(1); -+ } -+ -+ data += 32; -+ len -= 8; -+ } -+ } -+ -+ __raw_readsl(info->mmio_base + NDDB, data, len); -+} -+ - static void handle_data_pio(struct pxa3xx_nand_info *info) - { - unsigned int do_bytes = min(info->data_size, info->chunk_size); -@@ -497,14 +533,14 @@ static void handle_data_pio(struct pxa3xx_nand_info *info) - DIV_ROUND_UP(info->oob_size, 4)); - break; - case STATE_PIO_READING: -- __raw_readsl(info->mmio_base + NDDB, -- info->data_buff + info->data_buff_pos, -- DIV_ROUND_UP(do_bytes, 4)); -+ drain_fifo(info, -+ info->data_buff + info->data_buff_pos, -+ DIV_ROUND_UP(do_bytes, 4)); - - if (info->oob_size > 0) -- __raw_readsl(info->mmio_base + NDDB, -- info->oob_buff + info->oob_buff_pos, -- DIV_ROUND_UP(info->oob_size, 4)); -+ drain_fifo(info, -+ info->oob_buff + info->oob_buff_pos, -+ DIV_ROUND_UP(info->oob_size, 4)); - break; - default: - dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__, -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index 1468c4658804..84ad2b44377c 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -502,6 +502,14 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) - skb->pkt_type = PACKET_BROADCAST; - skb->ip_summed = CHECKSUM_UNNECESSARY; - -+ skb_reset_mac_header(skb); -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ -+ skb_reset_mac_header(skb); -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ - can_skb_reserve(skb); - can_skb_prv(skb)->ifindex = dev->ifindex; - -diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c -index 7d4382286457..242874041ba4 100644 ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c -@@ -12395,6 +12395,9 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, - pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, - PCICFG_VENDOR_ID_OFFSET); - -+ /* Set PCIe reset type to fundamental for EEH recovery */ -+ pdev->needs_freset = 1; -+ - /* AER (Advanced Error reporting) configuration */ - rc = pci_enable_pcie_error_reporting(pdev); - if (!rc) -diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c -index 3eed708a6182..fe48f4c51373 100644 ---- a/drivers/net/usb/cx82310_eth.c -+++ b/drivers/net/usb/cx82310_eth.c -@@ -300,9 +300,18 @@ static const struct driver_info cx82310_info = { - .tx_fixup = cx82310_tx_fixup, - }; - -+#define USB_DEVICE_CLASS(vend, prod, cl, sc, pr) \ -+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ -+ USB_DEVICE_ID_MATCH_DEV_INFO, \ -+ .idVendor = (vend), \ -+ .idProduct = (prod), \ -+ .bDeviceClass = (cl), \ -+ .bDeviceSubClass = (sc), \ -+ .bDeviceProtocol = (pr) -+ - static const struct usb_device_id products[] = { - { -- USB_DEVICE_AND_INTERFACE_INFO(0x0572, 0xcb01, 0xff, 0, 0), -+ USB_DEVICE_CLASS(0x0572, 0xcb01, 0xff, 0, 0), - .driver_info = (unsigned long) &cx82310_info - }, - { }, -diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c -index b7984044232d..5d8d2dcd975e 100644 ---- a/drivers/regulator/core.c -+++ b/drivers/regulator/core.c -@@ -1764,10 +1764,12 @@ static int _regulator_do_enable(struct regulator_dev *rdev) - trace_regulator_enable(rdev_get_name(rdev)); - - if (rdev->ena_pin) { -- ret = regulator_ena_gpio_ctrl(rdev, true); -- if (ret < 0) -- return ret; -- rdev->ena_gpio_state = 1; -+ if (!rdev->ena_gpio_state) { -+ ret = regulator_ena_gpio_ctrl(rdev, true); -+ if (ret < 0) -+ return ret; -+ rdev->ena_gpio_state = 1; -+ } - } else if (rdev->desc->ops->enable) { - ret = rdev->desc->ops->enable(rdev); - if (ret < 0) -@@ -1897,10 +1899,12 @@ static int _regulator_do_disable(struct regulator_dev *rdev) - trace_regulator_disable(rdev_get_name(rdev)); - - if (rdev->ena_pin) { -- ret = regulator_ena_gpio_ctrl(rdev, false); -- if (ret < 0) -- return ret; -- rdev->ena_gpio_state = 0; -+ if (rdev->ena_gpio_state) { -+ ret = regulator_ena_gpio_ctrl(rdev, false); -+ if (ret < 0) -+ return ret; -+ rdev->ena_gpio_state = 0; -+ } - - } else if (rdev->desc->ops->disable) { - ret = rdev->desc->ops->disable(rdev); -@@ -3454,12 +3458,6 @@ regulator_register(const struct regulator_desc *regulator_desc, - config->ena_gpio, ret); - goto wash; - } -- -- if (config->ena_gpio_flags & GPIOF_OUT_INIT_HIGH) -- rdev->ena_gpio_state = 1; -- -- if (config->ena_gpio_invert) -- rdev->ena_gpio_state = !rdev->ena_gpio_state; - } - - /* set regulator constraints */ -@@ -3631,9 +3629,11 @@ int regulator_suspend_finish(void) - list_for_each_entry(rdev, ®ulator_list, list) { - mutex_lock(&rdev->mutex); - if (rdev->use_count > 0 || rdev->constraints->always_on) { -- error = _regulator_do_enable(rdev); -- if (error) -- ret = error; -+ if (!_regulator_is_enabled(rdev)) { -+ error = _regulator_do_enable(rdev); -+ if (error) -+ ret = error; -+ } - } else { - if (!have_full_constraints()) - goto unlock; -diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c -index 62b58d38ce2e..60de66252fa2 100644 ---- a/drivers/scsi/libsas/sas_discover.c -+++ b/drivers/scsi/libsas/sas_discover.c -@@ -500,6 +500,7 @@ static void sas_revalidate_domain(struct work_struct *work) - struct sas_discovery_event *ev = to_sas_discovery_event(work); - struct asd_sas_port *port = ev->port; - struct sas_ha_struct *ha = port->ha; -+ struct domain_device *ddev = port->port_dev; - - /* prevent revalidation from finding sata links in recovery */ - mutex_lock(&ha->disco_mutex); -@@ -514,8 +515,9 @@ static void sas_revalidate_domain(struct work_struct *work) - SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, - task_pid_nr(current)); - -- if (port->port_dev) -- res = sas_ex_revalidate_domain(port->port_dev); -+ if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE || -+ ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE)) -+ res = sas_ex_revalidate_domain(ddev); - - SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", - port->id, task_pid_nr(current), res); -diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c -index 5d7b07f08326..5f8c6d2f4df7 100644 ---- a/drivers/spi/spi-atmel.c -+++ b/drivers/spi/spi-atmel.c -@@ -781,17 +781,17 @@ static void atmel_spi_pdc_next_xfer(struct spi_master *master, - (unsigned long long)xfer->rx_dma); - } - -- /* REVISIT: We're waiting for ENDRX before we start the next -+ /* REVISIT: We're waiting for RXBUFF before we start the next - * transfer because we need to handle some difficult timing -- * issues otherwise. If we wait for ENDTX in one transfer and -- * then starts waiting for ENDRX in the next, it's difficult -- * to tell the difference between the ENDRX interrupt we're -- * actually waiting for and the ENDRX interrupt of the -+ * issues otherwise. If we wait for TXBUFE in one transfer and -+ * then starts waiting for RXBUFF in the next, it's difficult -+ * to tell the difference between the RXBUFF interrupt we're -+ * actually waiting for and the RXBUFF interrupt of the - * previous transfer. - * - * It should be doable, though. Just not now... - */ -- spi_writel(as, IER, SPI_BIT(ENDRX) | SPI_BIT(OVRES)); -+ spi_writel(as, IER, SPI_BIT(RXBUFF) | SPI_BIT(OVRES)); - spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); - } - -diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c -index 971855e859c7..fe091a87fd6d 100644 ---- a/drivers/spi/spi-pl022.c -+++ b/drivers/spi/spi-pl022.c -@@ -503,12 +503,12 @@ static void giveback(struct pl022 *pl022) - pl022->cur_msg = NULL; - pl022->cur_transfer = NULL; - pl022->cur_chip = NULL; -- spi_finalize_current_message(pl022->master); - - /* disable the SPI/SSP operation */ - writew((readw(SSP_CR1(pl022->virtbase)) & - (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); - -+ spi_finalize_current_message(pl022->master); - } - - /** -diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c -index be89260c23a6..27e1a6e62d06 100644 ---- a/drivers/staging/iio/adc/mxs-lradc.c -+++ b/drivers/staging/iio/adc/mxs-lradc.c -@@ -1159,7 +1159,6 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data) - LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); - } - -- if (iio_buffer_enabled(iio)) - if (iio_buffer_enabled(iio)) { - if (reg & lradc->buffer_vchans) - iio_trigger_poll(iio->trig, iio_get_time_ns()); -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 104f29e6b290..e168a63e77ea 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -4196,11 +4196,17 @@ int iscsit_close_connection( - pr_debug("Closing iSCSI connection CID %hu on SID:" - " %u\n", conn->cid, sess->sid); - /* -- * Always up conn_logout_comp just in case the RX Thread is sleeping -- * and the logout response never got sent because the connection -- * failed. -+ * Always up conn_logout_comp for the traditional TCP case just in case -+ * the RX Thread in iscsi_target_rx_opcode() is sleeping and the logout -+ * response never got sent because the connection failed. -+ * -+ * However for iser-target, isert_wait4logout() is using conn_logout_comp -+ * to signal logout response TX interrupt completion. Go ahead and skip -+ * this for iser since isert_rx_opcode() does not wait on logout failure, -+ * and to avoid iscsi_conn pointer dereference in iser-target code. - */ -- complete(&conn->conn_logout_comp); -+ if (conn->conn_transport->transport_type == ISCSI_TCP) -+ complete(&conn->conn_logout_comp); - - iscsi_release_thread_set(conn); - -diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c -index 26ae6886ac59..093b8cb85de7 100644 ---- a/drivers/target/target_core_device.c -+++ b/drivers/target/target_core_device.c -@@ -1591,8 +1591,6 @@ int target_configure_device(struct se_device *dev) - ret = dev->transport->configure_device(dev); - if (ret) - goto out; -- dev->dev_flags |= DF_CONFIGURED; -- - /* - * XXX: there is not much point to have two different values here.. - */ -@@ -1654,6 +1652,8 @@ int target_configure_device(struct se_device *dev) - list_add_tail(&dev->g_dev_node, &g_device_list); - mutex_unlock(&g_device_mutex); - -+ dev->dev_flags |= DF_CONFIGURED; -+ - return 0; - - out_free_alua: -diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c -index 0fccdcfd1015..70cb37516d40 100644 ---- a/drivers/target/target_core_pr.c -+++ b/drivers/target/target_core_pr.c -@@ -76,7 +76,7 @@ enum preempt_type { - }; - - static void __core_scsi3_complete_pro_release(struct se_device *, struct se_node_acl *, -- struct t10_pr_registration *, int); -+ struct t10_pr_registration *, int, int); - - static sense_reason_t - target_scsi2_reservation_check(struct se_cmd *cmd) -@@ -528,6 +528,18 @@ static int core_scsi3_pr_seq_non_holder( - - return 0; - } -+ } else if (we && registered_nexus) { -+ /* -+ * Reads are allowed for Write Exclusive locks -+ * from all registrants. -+ */ -+ if (cmd->data_direction == DMA_FROM_DEVICE) { -+ pr_debug("Allowing READ CDB: 0x%02x for %s" -+ " reservation\n", cdb[0], -+ core_scsi3_pr_dump_type(pr_reg_type)); -+ -+ return 0; -+ } - } - pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" - " for %s reservation\n", transport_dump_cmd_direction(cmd), -@@ -1186,7 +1198,7 @@ static int core_scsi3_check_implicit_release( - * service action with the SERVICE ACTION RESERVATION KEY - * field set to zero (see 5.7.11.3). - */ -- __core_scsi3_complete_pro_release(dev, nacl, pr_reg, 0); -+ __core_scsi3_complete_pro_release(dev, nacl, pr_reg, 0, 1); - ret = 1; - /* - * For 'All Registrants' reservation types, all existing -@@ -1228,7 +1240,8 @@ static void __core_scsi3_free_registration( - - pr_reg->pr_reg_deve->def_pr_registered = 0; - pr_reg->pr_reg_deve->pr_res_key = 0; -- list_del(&pr_reg->pr_reg_list); -+ if (!list_empty(&pr_reg->pr_reg_list)) -+ list_del(&pr_reg->pr_reg_list); - /* - * Caller accessing *pr_reg using core_scsi3_locate_pr_reg(), - * so call core_scsi3_put_pr_reg() to decrement our reference. -@@ -1280,6 +1293,7 @@ void core_scsi3_free_pr_reg_from_nacl( - { - struct t10_reservation *pr_tmpl = &dev->t10_pr; - struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_res_holder; -+ bool free_reg = false; - /* - * If the passed se_node_acl matches the reservation holder, - * release the reservation. -@@ -1287,13 +1301,18 @@ void core_scsi3_free_pr_reg_from_nacl( - spin_lock(&dev->dev_reservation_lock); - pr_res_holder = dev->dev_pr_res_holder; - if ((pr_res_holder != NULL) && -- (pr_res_holder->pr_reg_nacl == nacl)) -- __core_scsi3_complete_pro_release(dev, nacl, pr_res_holder, 0); -+ (pr_res_holder->pr_reg_nacl == nacl)) { -+ __core_scsi3_complete_pro_release(dev, nacl, pr_res_holder, 0, 1); -+ free_reg = true; -+ } - spin_unlock(&dev->dev_reservation_lock); - /* - * Release any registration associated with the struct se_node_acl. - */ - spin_lock(&pr_tmpl->registration_lock); -+ if (pr_res_holder && free_reg) -+ __core_scsi3_free_registration(dev, pr_res_holder, NULL, 0); -+ - list_for_each_entry_safe(pr_reg, pr_reg_tmp, - &pr_tmpl->registration_list, pr_reg_list) { - -@@ -1316,7 +1335,7 @@ void core_scsi3_free_all_registrations( - if (pr_res_holder != NULL) { - struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl; - __core_scsi3_complete_pro_release(dev, pr_res_nacl, -- pr_res_holder, 0); -+ pr_res_holder, 0, 0); - } - spin_unlock(&dev->dev_reservation_lock); - -@@ -2126,13 +2145,13 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, - /* - * sa_res_key=0 Unregister Reservation Key for registered I_T Nexus. - */ -- pr_holder = core_scsi3_check_implicit_release( -- cmd->se_dev, pr_reg); -+ type = pr_reg->pr_res_type; -+ pr_holder = core_scsi3_check_implicit_release(cmd->se_dev, -+ pr_reg); - if (pr_holder < 0) { - ret = TCM_RESERVATION_CONFLICT; - goto out; - } -- type = pr_reg->pr_res_type; - - spin_lock(&pr_tmpl->registration_lock); - /* -@@ -2290,6 +2309,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key) - spin_lock(&dev->dev_reservation_lock); - pr_res_holder = dev->dev_pr_res_holder; - if (pr_res_holder) { -+ int pr_res_type = pr_res_holder->pr_res_type; - /* - * From spc4r17 Section 5.7.9: Reserving: - * -@@ -2300,7 +2320,9 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key) - * the logical unit, then the command shall be completed with - * RESERVATION CONFLICT status. - */ -- if (pr_res_holder != pr_reg) { -+ if ((pr_res_holder != pr_reg) && -+ (pr_res_type != PR_TYPE_WRITE_EXCLUSIVE_ALLREG) && -+ (pr_res_type != PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) { - struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl; - pr_err("SPC-3 PR: Attempted RESERVE from" - " [%s]: %s while reservation already held by" -@@ -2406,23 +2428,59 @@ static void __core_scsi3_complete_pro_release( - struct se_device *dev, - struct se_node_acl *se_nacl, - struct t10_pr_registration *pr_reg, -- int explicit) -+ int explicit, -+ int unreg) - { - struct target_core_fabric_ops *tfo = se_nacl->se_tpg->se_tpg_tfo; - char i_buf[PR_REG_ISID_ID_LEN]; -+ int pr_res_type = 0, pr_res_scope = 0; - - memset(i_buf, 0, PR_REG_ISID_ID_LEN); - core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); - /* - * Go ahead and release the current PR reservation holder. -+ * If an All Registrants reservation is currently active and -+ * a unregister operation is requested, replace the current -+ * dev_pr_res_holder with another active registration. - */ -- dev->dev_pr_res_holder = NULL; -+ if (dev->dev_pr_res_holder) { -+ pr_res_type = dev->dev_pr_res_holder->pr_res_type; -+ pr_res_scope = dev->dev_pr_res_holder->pr_res_scope; -+ dev->dev_pr_res_holder->pr_res_type = 0; -+ dev->dev_pr_res_holder->pr_res_scope = 0; -+ dev->dev_pr_res_holder->pr_res_holder = 0; -+ dev->dev_pr_res_holder = NULL; -+ } -+ if (!unreg) -+ goto out; - -- pr_debug("SPC-3 PR [%s] Service Action: %s RELEASE cleared" -- " reservation holder TYPE: %s ALL_TG_PT: %d\n", -- tfo->get_fabric_name(), (explicit) ? "explicit" : "implicit", -- core_scsi3_pr_dump_type(pr_reg->pr_res_type), -- (pr_reg->pr_reg_all_tg_pt) ? 1 : 0); -+ spin_lock(&dev->t10_pr.registration_lock); -+ list_del_init(&pr_reg->pr_reg_list); -+ /* -+ * If the I_T nexus is a reservation holder, the persistent reservation -+ * is of an all registrants type, and the I_T nexus is the last remaining -+ * registered I_T nexus, then the device server shall also release the -+ * persistent reservation. -+ */ -+ if (!list_empty(&dev->t10_pr.registration_list) && -+ ((pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || -+ (pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG))) { -+ dev->dev_pr_res_holder = -+ list_entry(dev->t10_pr.registration_list.next, -+ struct t10_pr_registration, pr_reg_list); -+ dev->dev_pr_res_holder->pr_res_type = pr_res_type; -+ dev->dev_pr_res_holder->pr_res_scope = pr_res_scope; -+ dev->dev_pr_res_holder->pr_res_holder = 1; -+ } -+ spin_unlock(&dev->t10_pr.registration_lock); -+out: -+ if (!dev->dev_pr_res_holder) { -+ pr_debug("SPC-3 PR [%s] Service Action: %s RELEASE cleared" -+ " reservation holder TYPE: %s ALL_TG_PT: %d\n", -+ tfo->get_fabric_name(), (explicit) ? "explicit" : -+ "implicit", core_scsi3_pr_dump_type(pr_res_type), -+ (pr_reg->pr_reg_all_tg_pt) ? 1 : 0); -+ } - pr_debug("SPC-3 PR [%s] RELEASE Node: %s%s\n", - tfo->get_fabric_name(), se_nacl->initiatorname, - i_buf); -@@ -2553,7 +2611,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope, - * server shall not establish a unit attention condition. - */ - __core_scsi3_complete_pro_release(dev, se_sess->se_node_acl, -- pr_reg, 1); -+ pr_reg, 1, 0); - - spin_unlock(&dev->dev_reservation_lock); - -@@ -2641,7 +2699,7 @@ core_scsi3_emulate_pro_clear(struct se_cmd *cmd, u64 res_key) - if (pr_res_holder) { - struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl; - __core_scsi3_complete_pro_release(dev, pr_res_nacl, -- pr_res_holder, 0); -+ pr_res_holder, 0, 0); - } - spin_unlock(&dev->dev_reservation_lock); - /* -@@ -2700,7 +2758,7 @@ static void __core_scsi3_complete_pro_preempt( - */ - if (dev->dev_pr_res_holder) - __core_scsi3_complete_pro_release(dev, nacl, -- dev->dev_pr_res_holder, 0); -+ dev->dev_pr_res_holder, 0, 0); - - dev->dev_pr_res_holder = pr_reg; - pr_reg->pr_res_holder = 1; -@@ -2944,8 +3002,8 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, - */ - if (pr_reg_n != pr_res_holder) - __core_scsi3_complete_pro_release(dev, -- pr_res_holder->pr_reg_nacl, -- dev->dev_pr_res_holder, 0); -+ pr_res_holder->pr_reg_nacl, -+ dev->dev_pr_res_holder, 0, 0); - /* - * b) Remove the registrations for all I_T nexuses identified - * by the SERVICE ACTION RESERVATION KEY field, except the -@@ -3415,7 +3473,7 @@ after_iport_check: - * holder (i.e., the I_T nexus on which the - */ - __core_scsi3_complete_pro_release(dev, pr_res_nacl, -- dev->dev_pr_res_holder, 0); -+ dev->dev_pr_res_holder, 0, 0); - /* - * g) Move the persistent reservation to the specified I_T nexus using - * the same scope and type as the persistent reservation released in -@@ -3855,7 +3913,8 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) - unsigned char *buf; - u32 add_desc_len = 0, add_len = 0, desc_len, exp_desc_len; - u32 off = 8; /* off into first Full Status descriptor */ -- int format_code = 0; -+ int format_code = 0, pr_res_type = 0, pr_res_scope = 0; -+ bool all_reg = false; - - if (cmd->data_length < 8) { - pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u" -@@ -3872,6 +3931,19 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) - buf[2] = ((dev->t10_pr.pr_generation >> 8) & 0xff); - buf[3] = (dev->t10_pr.pr_generation & 0xff); - -+ spin_lock(&dev->dev_reservation_lock); -+ if (dev->dev_pr_res_holder) { -+ struct t10_pr_registration *pr_holder = dev->dev_pr_res_holder; -+ -+ if (pr_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG || -+ pr_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG) { -+ all_reg = true; -+ pr_res_type = pr_holder->pr_res_type; -+ pr_res_scope = pr_holder->pr_res_scope; -+ } -+ } -+ spin_unlock(&dev->dev_reservation_lock); -+ - spin_lock(&pr_tmpl->registration_lock); - list_for_each_entry_safe(pr_reg, pr_reg_tmp, - &pr_tmpl->registration_list, pr_reg_list) { -@@ -3921,14 +3993,20 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) - * reservation holder for PR_HOLDER bit. - * - * Also, if this registration is the reservation -- * holder, fill in SCOPE and TYPE in the next byte. -+ * holder or there is an All Registrants reservation -+ * active, fill in SCOPE and TYPE in the next byte. - */ - if (pr_reg->pr_res_holder) { - buf[off++] |= 0x01; - buf[off++] = (pr_reg->pr_res_scope & 0xf0) | - (pr_reg->pr_res_type & 0x0f); -- } else -+ } else if (all_reg) { -+ buf[off++] |= 0x01; -+ buf[off++] = (pr_res_scope & 0xf0) | -+ (pr_res_type & 0x0f); -+ } else { - off += 2; -+ } - - off += 4; /* Skip over reserved area */ - /* -diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c -index 0f199f6a0738..29f28808fc03 100644 ---- a/drivers/target/target_core_pscsi.c -+++ b/drivers/target/target_core_pscsi.c -@@ -1111,7 +1111,7 @@ static u32 pscsi_get_device_type(struct se_device *dev) - struct pscsi_dev_virt *pdv = PSCSI_DEV(dev); - struct scsi_device *sd = pdv->pdv_sd; - -- return sd->type; -+ return (sd) ? sd->type : TYPE_NO_LUN; - } - - static sector_t pscsi_get_blocks(struct se_device *dev) -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c -index e6463ef33cd2..9e54c0fe718d 100644 ---- a/drivers/target/target_core_transport.c -+++ b/drivers/target/target_core_transport.c -@@ -2327,6 +2327,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, - list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); - out: - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); -+ -+ if (ret && ack_kref) -+ target_put_sess_cmd(se_sess, se_cmd); -+ - return ret; - } - EXPORT_SYMBOL(target_get_sess_cmd); -diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c -index feda34404ed0..5892eab03874 100644 ---- a/drivers/tty/serial/8250/8250_pci.c -+++ b/drivers/tty/serial/8250/8250_pci.c -@@ -66,7 +66,7 @@ static void moan_device(const char *str, struct pci_dev *dev) - "Please send the output of lspci -vv, this\n" - "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" - "manufacturer and name of serial board or\n" -- "modem board to rmk+serial@arm.linux.org.uk.\n", -+ "modem board to .\n", - pci_name(dev), str, dev->vendor, dev->device, - dev->subsystem_vendor, dev->subsystem_device); - } -diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c -index f4a9e3311297..c8860a8757ac 100644 ---- a/drivers/xen/events/events_base.c -+++ b/drivers/xen/events/events_base.c -@@ -547,20 +547,26 @@ static unsigned int __startup_pirq(unsigned int irq) - pirq_query_unmask(irq); - - rc = set_evtchn_to_irq(evtchn, irq); -- if (rc != 0) { -- pr_err("irq%d: Failed to set port to irq mapping (%d)\n", -- irq, rc); -- xen_evtchn_close(evtchn); -- return 0; -- } -+ if (rc) -+ goto err; -+ - bind_evtchn_to_cpu(evtchn, 0); - info->evtchn = evtchn; - -+ rc = xen_evtchn_port_setup(info); -+ if (rc) -+ goto err; -+ - out: - unmask_evtchn(evtchn); - eoi_pirq(irq_get_irq_data(irq)); - - return 0; -+ -+err: -+ pr_err("irq%d: Failed to set port to irq mapping (%d)\n", irq, rc); -+ xen_evtchn_close(evtchn); -+ return 0; - } - - static unsigned int startup_pirq(struct irq_data *data) -diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c -index 46ae0f9f02ad..75fe3d466515 100644 ---- a/drivers/xen/xen-pciback/conf_space.c -+++ b/drivers/xen/xen-pciback/conf_space.c -@@ -16,7 +16,7 @@ - #include "conf_space.h" - #include "conf_space_quirks.h" - --static bool permissive; -+bool permissive; - module_param(permissive, bool, 0644); - - /* This is where xen_pcibk_read_config_byte, xen_pcibk_read_config_word, -diff --git a/drivers/xen/xen-pciback/conf_space.h b/drivers/xen/xen-pciback/conf_space.h -index e56c934ad137..2e1d73d1d5d0 100644 ---- a/drivers/xen/xen-pciback/conf_space.h -+++ b/drivers/xen/xen-pciback/conf_space.h -@@ -64,6 +64,8 @@ struct config_field_entry { - void *data; - }; - -+extern bool permissive; -+ - #define OFFSET(cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset) - - /* Add fields to a device - the add_fields macro expects to get a pointer to -diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c -index c5ee82587e8c..2d7369391472 100644 ---- a/drivers/xen/xen-pciback/conf_space_header.c -+++ b/drivers/xen/xen-pciback/conf_space_header.c -@@ -11,6 +11,10 @@ - #include "pciback.h" - #include "conf_space.h" - -+struct pci_cmd_info { -+ u16 val; -+}; -+ - struct pci_bar_info { - u32 val; - u32 len_val; -@@ -20,22 +24,36 @@ struct pci_bar_info { - #define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO)) - #define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER) - --static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data) -+/* Bits guests are allowed to control in permissive mode. */ -+#define PCI_COMMAND_GUEST (PCI_COMMAND_MASTER|PCI_COMMAND_SPECIAL| \ -+ PCI_COMMAND_INVALIDATE|PCI_COMMAND_VGA_PALETTE| \ -+ PCI_COMMAND_WAIT|PCI_COMMAND_FAST_BACK) -+ -+static void *command_init(struct pci_dev *dev, int offset) - { -- int i; -- int ret; -- -- ret = xen_pcibk_read_config_word(dev, offset, value, data); -- if (!pci_is_enabled(dev)) -- return ret; -- -- for (i = 0; i < PCI_ROM_RESOURCE; i++) { -- if (dev->resource[i].flags & IORESOURCE_IO) -- *value |= PCI_COMMAND_IO; -- if (dev->resource[i].flags & IORESOURCE_MEM) -- *value |= PCI_COMMAND_MEMORY; -+ struct pci_cmd_info *cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); -+ int err; -+ -+ if (!cmd) -+ return ERR_PTR(-ENOMEM); -+ -+ err = pci_read_config_word(dev, PCI_COMMAND, &cmd->val); -+ if (err) { -+ kfree(cmd); -+ return ERR_PTR(err); - } - -+ return cmd; -+} -+ -+static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data) -+{ -+ int ret = pci_read_config_word(dev, offset, value); -+ const struct pci_cmd_info *cmd = data; -+ -+ *value &= PCI_COMMAND_GUEST; -+ *value |= cmd->val & ~PCI_COMMAND_GUEST; -+ - return ret; - } - -@@ -43,6 +61,8 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) - { - struct xen_pcibk_dev_data *dev_data; - int err; -+ u16 val; -+ struct pci_cmd_info *cmd = data; - - dev_data = pci_get_drvdata(dev); - if (!pci_is_enabled(dev) && is_enable_cmd(value)) { -@@ -83,6 +103,19 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) - } - } - -+ cmd->val = value; -+ -+ if (!permissive && (!dev_data || !dev_data->permissive)) -+ return 0; -+ -+ /* Only allow the guest to control certain bits. */ -+ err = pci_read_config_word(dev, offset, &val); -+ if (err || val == value) -+ return err; -+ -+ value &= PCI_COMMAND_GUEST; -+ value |= val & ~PCI_COMMAND_GUEST; -+ - return pci_write_config_word(dev, offset, value); - } - -@@ -282,6 +315,8 @@ static const struct config_field header_common[] = { - { - .offset = PCI_COMMAND, - .size = 2, -+ .init = command_init, -+ .release = bar_release, - .u.w.read = command_read, - .u.w.write = command_write, - }, -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index 6eb13c621a14..499155ca3e84 100644 ---- a/fs/fuse/dev.c -+++ b/fs/fuse/dev.c -@@ -819,8 +819,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) - - newpage = buf->page; - -- if (WARN_ON(!PageUptodate(newpage))) -- return -EIO; -+ if (!PageUptodate(newpage)) -+ SetPageUptodate(newpage); - - ClearPageMappedToDisk(newpage); - -@@ -1726,6 +1726,9 @@ copy_finish: - static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, - unsigned int size, struct fuse_copy_state *cs) - { -+ /* Don't try to move pages (yet) */ -+ cs->move_pages = 0; -+ - switch (code) { - case FUSE_NOTIFY_POLL: - return fuse_notify_poll(fc, size, cs); -diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c -index 5bee81674d53..14538a865102 100644 ---- a/fs/nilfs2/segment.c -+++ b/fs/nilfs2/segment.c -@@ -1906,6 +1906,7 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, - struct the_nilfs *nilfs) - { - struct nilfs_inode_info *ii, *n; -+ int during_mount = !(sci->sc_super->s_flags & MS_ACTIVE); - int defer_iput = false; - - spin_lock(&nilfs->ns_inode_lock); -@@ -1918,10 +1919,10 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, - brelse(ii->i_bh); - ii->i_bh = NULL; - list_del_init(&ii->i_dirty); -- if (!ii->vfs_inode.i_nlink) { -+ if (!ii->vfs_inode.i_nlink || during_mount) { - /* -- * Defer calling iput() to avoid a deadlock -- * over I_SYNC flag for inodes with i_nlink == 0 -+ * Defer calling iput() to avoid deadlocks if -+ * i_nlink == 0 or mount is not yet finished. - */ - list_add_tail(&ii->i_dirty, &sci->sc_iput_queue); - defer_iput = true; -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index c4b2646b6d7c..c2546717fc2b 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -1227,6 +1227,9 @@ out: - - static int pagemap_open(struct inode *inode, struct file *file) - { -+ /* do not disclose physical addresses: attack vector */ -+ if (!capable(CAP_SYS_ADMIN)) -+ return -EPERM; - pr_warn_once("Bits 55-60 of /proc/PID/pagemap entries are about " - "to stop being page-shift some time soon. See the " - "linux/Documentation/vm/pagemap.txt for details.\n"); -diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h -index 6c62cfa25f1a..bc9d2c2ddf87 100644 ---- a/include/linux/workqueue.h -+++ b/include/linux/workqueue.h -@@ -71,7 +71,8 @@ enum { - /* data contains off-queue information when !WORK_STRUCT_PWQ */ - WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT, - -- WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), -+ __WORK_OFFQ_CANCELING = WORK_OFFQ_FLAG_BASE, -+ WORK_OFFQ_CANCELING = (1 << __WORK_OFFQ_CANCELING), - - /* - * When a work item is off queue, its high bits point to the last -diff --git a/kernel/cpuset.c b/kernel/cpuset.c -index 2fb2877e6961..7b4530b0b16b 100644 ---- a/kernel/cpuset.c -+++ b/kernel/cpuset.c -@@ -503,9 +503,6 @@ static void update_domain_attr_tree(struct sched_domain_attr *dattr, - - rcu_read_lock(); - cpuset_for_each_descendant_pre(cp, pos_css, root_cs) { -- if (cp == root_cs) -- continue; -- - /* skip the whole subtree if @cp doesn't have any CPU */ - if (cpumask_empty(cp->cpus_allowed)) { - pos_css = css_rightmost_descendant(pos_css); -diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h -index cbd69d842341..2ca4a8b5fe57 100644 ---- a/kernel/printk/console_cmdline.h -+++ b/kernel/printk/console_cmdline.h -@@ -3,7 +3,7 @@ - - struct console_cmdline - { -- char name[8]; /* Name of the driver */ -+ char name[16]; /* Name of the driver */ - int index; /* Minor dev. to use */ - char *options; /* Options for the driver */ - #ifdef CONFIG_A11Y_BRAILLE_CONSOLE -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index 8c086e6049b9..a755ad70fe8f 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c -@@ -2280,6 +2280,7 @@ void register_console(struct console *newcon) - for (i = 0, c = console_cmdline; - i < MAX_CMDLINECONSOLES && c->name[0]; - i++, c++) { -+ BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name)); - if (strcmp(c->name, newcon->name) != 0) - continue; - if (newcon->index >= 0 && -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index f6f31d823e8e..423c9e37a9e7 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -2893,19 +2893,57 @@ bool flush_work(struct work_struct *work) - } - EXPORT_SYMBOL_GPL(flush_work); - -+struct cwt_wait { -+ wait_queue_t wait; -+ struct work_struct *work; -+}; -+ -+static int cwt_wakefn(wait_queue_t *wait, unsigned mode, int sync, void *key) -+{ -+ struct cwt_wait *cwait = container_of(wait, struct cwt_wait, wait); -+ -+ if (cwait->work != key) -+ return 0; -+ return autoremove_wake_function(wait, mode, sync, key); -+} -+ - static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) - { -+ static DECLARE_WAIT_QUEUE_HEAD(cancel_waitq); - unsigned long flags; - int ret; - - do { - ret = try_to_grab_pending(work, is_dwork, &flags); - /* -- * If someone else is canceling, wait for the same event it -- * would be waiting for before retrying. -+ * If someone else is already canceling, wait for it to -+ * finish. flush_work() doesn't work for PREEMPT_NONE -+ * because we may get scheduled between @work's completion -+ * and the other canceling task resuming and clearing -+ * CANCELING - flush_work() will return false immediately -+ * as @work is no longer busy, try_to_grab_pending() will -+ * return -ENOENT as @work is still being canceled and the -+ * other canceling task won't be able to clear CANCELING as -+ * we're hogging the CPU. -+ * -+ * Let's wait for completion using a waitqueue. As this -+ * may lead to the thundering herd problem, use a custom -+ * wake function which matches @work along with exclusive -+ * wait and wakeup. - */ -- if (unlikely(ret == -ENOENT)) -- flush_work(work); -+ if (unlikely(ret == -ENOENT)) { -+ struct cwt_wait cwait; -+ -+ init_wait(&cwait.wait); -+ cwait.wait.func = cwt_wakefn; -+ cwait.work = work; -+ -+ prepare_to_wait_exclusive(&cancel_waitq, &cwait.wait, -+ TASK_UNINTERRUPTIBLE); -+ if (work_is_canceling(work)) -+ schedule(); -+ finish_wait(&cancel_waitq, &cwait.wait); -+ } - } while (unlikely(ret < 0)); - - /* tell other tasks trying to grab @work to back off */ -@@ -2914,6 +2952,16 @@ static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) - - flush_work(work); - clear_work_data(work); -+ -+ /* -+ * Paired with prepare_to_wait() above so that either -+ * waitqueue_active() is visible here or !work_is_canceling() is -+ * visible there. -+ */ -+ smp_mb(); -+ if (waitqueue_active(&cancel_waitq)) -+ __wake_up(&cancel_waitq, TASK_NORMAL, 1, work); -+ - return ret; - } - -diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c -index 7a85967060a5..f0f5c5c3de12 100644 ---- a/lib/lz4/lz4_decompress.c -+++ b/lib/lz4/lz4_decompress.c -@@ -139,6 +139,9 @@ static int lz4_uncompress(const char *source, char *dest, int osize) - /* Error: request to write beyond destination buffer */ - if (cpy > oend) - goto _output_error; -+ if ((ref + COPYLENGTH) > oend || -+ (op + COPYLENGTH) > oend) -+ goto _output_error; - LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH)); - while (op < cpy) - *op++ = *ref++; -diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c -index d6be3edb7a43..526bf56f4d31 100644 ---- a/net/caif/caif_socket.c -+++ b/net/caif/caif_socket.c -@@ -283,7 +283,7 @@ static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock, - int copylen; - - ret = -EOPNOTSUPP; -- if (m->msg_flags&MSG_OOB) -+ if (flags & MSG_OOB) - goto read_error; - - skb = skb_recv_datagram(sk, flags, 0 , &ret); -diff --git a/net/can/af_can.c b/net/can/af_can.c -index a27f8aad9e99..5e9a2272b7a7 100644 ---- a/net/can/af_can.c -+++ b/net/can/af_can.c -@@ -262,6 +262,9 @@ int can_send(struct sk_buff *skb, int loop) - goto inval_skb; - } - -+ skb->ip_summed = CHECKSUM_UNNECESSARY; -+ -+ skb_reset_mac_header(skb); - skb_reset_network_header(skb); - skb_reset_transport_header(skb); - -diff --git a/net/compat.c b/net/compat.c -index 275af79c131b..d12529050b29 100644 ---- a/net/compat.c -+++ b/net/compat.c -@@ -71,6 +71,13 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg) - __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || - __get_user(kmsg->msg_flags, &umsg->msg_flags)) - return -EFAULT; -+ -+ if (!tmp1) -+ kmsg->msg_namelen = 0; -+ -+ if (kmsg->msg_namelen < 0) -+ return -EINVAL; -+ - if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) - kmsg->msg_namelen = sizeof(struct sockaddr_storage); - kmsg->msg_name = compat_ptr(tmp1); -diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c -index cf9cd13509a7..e731c96eac4b 100644 ---- a/net/core/sysctl_net_core.c -+++ b/net/core/sysctl_net_core.c -@@ -25,6 +25,8 @@ - static int zero = 0; - static int one = 1; - static int ushort_max = USHRT_MAX; -+static int min_sndbuf = SOCK_MIN_SNDBUF; -+static int min_rcvbuf = SOCK_MIN_RCVBUF; - - #ifdef CONFIG_RPS - static int rps_sock_flow_sysctl(struct ctl_table *table, int write, -@@ -223,7 +225,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_sndbuf, - }, - { - .procname = "rmem_max", -@@ -231,7 +233,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_rcvbuf, - }, - { - .procname = "wmem_default", -@@ -239,7 +241,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_sndbuf, - }, - { - .procname = "rmem_default", -@@ -247,7 +249,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_rcvbuf, - }, - { - .procname = "dev_weight", -diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c -index e34dccbc4d70..4eeba4e497a0 100644 ---- a/net/ipv4/inet_diag.c -+++ b/net/ipv4/inet_diag.c -@@ -71,6 +71,20 @@ static inline void inet_diag_unlock_handler( - mutex_unlock(&inet_diag_table_mutex); - } - -+static size_t inet_sk_attr_size(void) -+{ -+ return nla_total_size(sizeof(struct tcp_info)) -+ + nla_total_size(1) /* INET_DIAG_SHUTDOWN */ -+ + nla_total_size(1) /* INET_DIAG_TOS */ -+ + nla_total_size(1) /* INET_DIAG_TCLASS */ -+ + nla_total_size(sizeof(struct inet_diag_meminfo)) -+ + nla_total_size(sizeof(struct inet_diag_msg)) -+ + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) -+ + nla_total_size(TCP_CA_NAME_MAX) -+ + nla_total_size(sizeof(struct tcpvegas_info)) -+ + 64; -+} -+ - int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, - struct sk_buff *skb, struct inet_diag_req_v2 *req, - struct user_namespace *user_ns, -@@ -324,9 +338,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_s - if (err) - goto out; - -- rep = nlmsg_new(sizeof(struct inet_diag_msg) + -- sizeof(struct inet_diag_meminfo) + -- sizeof(struct tcp_info) + 64, GFP_KERNEL); -+ rep = nlmsg_new(inet_sk_attr_size(), GFP_KERNEL); - if (!rep) { - err = -ENOMEM; - goto out; -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 7efa26bb872c..d0c310801479 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2617,15 +2617,11 @@ void tcp_send_fin(struct sock *sk) - } else { - /* Socket is locked, keep trying until memory is available. */ - for (;;) { -- skb = alloc_skb_fclone(MAX_TCP_HEADER, -- sk->sk_allocation); -+ skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); - if (skb) - break; - yield(); - } -- -- /* Reserve space for headers and prepare control bits. */ -- skb_reserve(skb, MAX_TCP_HEADER); - /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ - tcp_init_nondata_skb(skb, tp->write_seq, - TCPHDR_ACK | TCPHDR_FIN); -@@ -2899,9 +2895,9 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) - { - struct tcp_sock *tp = tcp_sk(sk); - struct tcp_fastopen_request *fo = tp->fastopen_req; -- int syn_loss = 0, space, i, err = 0, iovlen = fo->data->msg_iovlen; -- struct sk_buff *syn_data = NULL, *data; -+ int syn_loss = 0, space, err = 0; - unsigned long last_syn_loss = 0; -+ struct sk_buff *syn_data; - - tp->rx_opt.mss_clamp = tp->advmss; /* If MSS is not cached */ - tcp_fastopen_cache_get(sk, &tp->rx_opt.mss_clamp, &fo->cookie, -@@ -2932,42 +2928,38 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) - /* limit to order-0 allocations */ - space = min_t(size_t, space, SKB_MAX_HEAD(MAX_TCP_HEADER)); - -- syn_data = skb_copy_expand(syn, MAX_TCP_HEADER, space, -- sk->sk_allocation); -- if (syn_data == NULL) -+ syn_data = sk_stream_alloc_skb(sk, space, sk->sk_allocation); -+ if (!syn_data) - goto fallback; -+ syn_data->ip_summed = CHECKSUM_PARTIAL; -+ memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); -+ if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space), -+ fo->data->msg_iov, 0, space))) { -+ kfree_skb(syn_data); -+ goto fallback; -+ } - -- for (i = 0; i < iovlen && syn_data->len < space; ++i) { -- struct iovec *iov = &fo->data->msg_iov[i]; -- unsigned char __user *from = iov->iov_base; -- int len = iov->iov_len; -- -- if (syn_data->len + len > space) -- len = space - syn_data->len; -- else if (i + 1 == iovlen) -- /* No more data pending in inet_wait_for_connect() */ -- fo->data = NULL; -+ /* No more data pending in inet_wait_for_connect() */ -+ if (space == fo->size) -+ fo->data = NULL; -+ fo->copied = space; - -- if (skb_add_data(syn_data, from, len)) -- goto fallback; -- } -+ tcp_connect_queue_skb(sk, syn_data); - -- /* Queue a data-only packet after the regular SYN for retransmission */ -- data = pskb_copy(syn_data, sk->sk_allocation); -- if (data == NULL) -- goto fallback; -- TCP_SKB_CB(data)->seq++; -- TCP_SKB_CB(data)->tcp_flags &= ~TCPHDR_SYN; -- TCP_SKB_CB(data)->tcp_flags = (TCPHDR_ACK|TCPHDR_PSH); -- tcp_connect_queue_skb(sk, data); -- fo->copied = data->len; -+ err = tcp_transmit_skb(sk, syn_data, 1, sk->sk_allocation); - -- if (tcp_transmit_skb(sk, syn_data, 0, sk->sk_allocation) == 0) { -+ /* Now full SYN+DATA was cloned and sent (or not), -+ * remove the SYN from the original skb (syn_data) -+ * we keep in write queue in case of a retransmit, as we -+ * also have the SYN packet (with no data) in the same queue. -+ */ -+ TCP_SKB_CB(syn_data)->seq++; -+ TCP_SKB_CB(syn_data)->tcp_flags = TCPHDR_ACK | TCPHDR_PSH; -+ if (!err) { - tp->syn_data = (fo->copied > 0); - NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVE); - goto done; - } -- syn_data = NULL; - - fallback: - /* Send a regular SYN with Fast Open cookie request option */ -@@ -2976,7 +2968,6 @@ fallback: - err = tcp_transmit_skb(sk, syn, 1, sk->sk_allocation); - if (err) - tp->syn_fastopen = 0; -- kfree_skb(syn_data); - done: - fo->cookie.len = -1; /* Exclude Fast Open option for SYN retries */ - return err; -@@ -2996,13 +2987,10 @@ int tcp_connect(struct sock *sk) - return 0; - } - -- buff = alloc_skb_fclone(MAX_TCP_HEADER + 15, sk->sk_allocation); -- if (unlikely(buff == NULL)) -+ buff = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); -+ if (unlikely(!buff)) - return -ENOBUFS; - -- /* Reserve space for headers. */ -- skb_reserve(buff, MAX_TCP_HEADER); -- - tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN); - tp->retrans_stamp = TCP_SKB_CB(buff)->when = tcp_time_stamp; - tcp_connect_queue_skb(sk, buff); -diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c -index b4d5e1d97c1b..27ca79682efb 100644 ---- a/net/ipv6/fib6_rules.c -+++ b/net/ipv6/fib6_rules.c -@@ -104,6 +104,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, - goto again; - flp6->saddr = saddr; - } -+ err = rt->dst.error; - goto out; - } - again: -diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c -index 27d3f40de3cd..847d2a2c5d05 100644 ---- a/net/netfilter/ipvs/ip_vs_core.c -+++ b/net/netfilter/ipvs/ip_vs_core.c -@@ -658,16 +658,24 @@ static inline int ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user) - return err; - } - --static int ip_vs_route_me_harder(int af, struct sk_buff *skb) -+static int ip_vs_route_me_harder(int af, struct sk_buff *skb, -+ unsigned int hooknum) - { -+ if (!sysctl_snat_reroute(skb)) -+ return 0; -+ /* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */ -+ if (NF_INET_LOCAL_IN == hooknum) -+ return 0; - #ifdef CONFIG_IP_VS_IPV6 - if (af == AF_INET6) { -- if (sysctl_snat_reroute(skb) && ip6_route_me_harder(skb) != 0) -+ struct dst_entry *dst = skb_dst(skb); -+ -+ if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) && -+ ip6_route_me_harder(skb) != 0) - return 1; - } else - #endif -- if ((sysctl_snat_reroute(skb) || -- skb_rtable(skb)->rt_flags & RTCF_LOCAL) && -+ if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) && - ip_route_me_harder(skb, RTN_LOCAL) != 0) - return 1; - -@@ -790,7 +798,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb, - union nf_inet_addr *snet, - __u8 protocol, struct ip_vs_conn *cp, - struct ip_vs_protocol *pp, -- unsigned int offset, unsigned int ihl) -+ unsigned int offset, unsigned int ihl, -+ unsigned int hooknum) - { - unsigned int verdict = NF_DROP; - -@@ -820,7 +829,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb, - #endif - ip_vs_nat_icmp(skb, pp, cp, 1); - -- if (ip_vs_route_me_harder(af, skb)) -+ if (ip_vs_route_me_harder(af, skb, hooknum)) - goto out; - - /* do the statistics and put it back */ -@@ -915,7 +924,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related, - - snet.ip = iph->saddr; - return handle_response_icmp(AF_INET, skb, &snet, cih->protocol, cp, -- pp, ciph.len, ihl); -+ pp, ciph.len, ihl, hooknum); - } - - #ifdef CONFIG_IP_VS_IPV6 -@@ -980,7 +989,8 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related, - snet.in6 = ciph.saddr.in6; - writable = ciph.len; - return handle_response_icmp(AF_INET6, skb, &snet, ciph.protocol, cp, -- pp, writable, sizeof(struct ipv6hdr)); -+ pp, writable, sizeof(struct ipv6hdr), -+ hooknum); - } - #endif - -@@ -1039,7 +1049,8 @@ static inline bool is_new_conn(const struct sk_buff *skb, - */ - static unsigned int - handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, -- struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) -+ struct ip_vs_conn *cp, struct ip_vs_iphdr *iph, -+ unsigned int hooknum) - { - struct ip_vs_protocol *pp = pd->pp; - -@@ -1077,7 +1088,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, - * if it came from this machine itself. So re-compute - * the routing information. - */ -- if (ip_vs_route_me_harder(af, skb)) -+ if (ip_vs_route_me_harder(af, skb, hooknum)) - goto drop; - - IP_VS_DBG_PKT(10, af, pp, skb, 0, "After SNAT"); -@@ -1180,7 +1191,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af) - cp = pp->conn_out_get(af, skb, &iph, 0); - - if (likely(cp)) -- return handle_response(af, skb, pd, cp, &iph); -+ return handle_response(af, skb, pd, cp, &iph, hooknum); - if (sysctl_nat_icmp_send(net) && - (pp->protocol == IPPROTO_TCP || - pp->protocol == IPPROTO_UDP || -diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c -index db801263ee9f..a8027e73b6a2 100644 ---- a/net/netfilter/ipvs/ip_vs_sync.c -+++ b/net/netfilter/ipvs/ip_vs_sync.c -@@ -891,6 +891,8 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param, - IP_VS_DBG(2, "BACKUP, add new conn. failed\n"); - return; - } -+ if (!(flags & IP_VS_CONN_F_TEMPLATE)) -+ kfree(param->pe_data); - } - - if (opt) -@@ -1164,6 +1166,7 @@ static inline int ip_vs_proc_sync_conn(struct net *net, __u8 *p, __u8 *msg_end) - (opt_flags & IPVS_OPT_F_SEQ_DATA ? &opt : NULL) - ); - #endif -+ ip_vs_pe_put(param.pe); - return 0; - /* Error exit */ - out: -diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c -index ad979612238a..7350723aeb15 100644 ---- a/net/netfilter/nft_compat.c -+++ b/net/netfilter/nft_compat.c -@@ -611,8 +611,12 @@ nft_match_select_ops(const struct nft_ctx *ctx, - struct xt_match *match = nft_match->ops.data; - - if (strcmp(match->name, mt_name) == 0 && -- match->revision == rev && match->family == family) -+ match->revision == rev && match->family == family) { -+ if (!try_module_get(match->me)) -+ return ERR_PTR(-ENOENT); -+ - return &nft_match->ops; -+ } - } - - match = xt_request_find_match(family, mt_name, rev); -@@ -682,8 +686,12 @@ nft_target_select_ops(const struct nft_ctx *ctx, - struct xt_target *target = nft_target->ops.data; - - if (strcmp(target->name, tg_name) == 0 && -- target->revision == rev && target->family == family) -+ target->revision == rev && target->family == family) { -+ if (!try_module_get(target->me)) -+ return ERR_PTR(-ENOENT); -+ - return &nft_target->ops; -+ } - } - - target = xt_request_find_target(family, tg_name, rev); -diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c -index 1ba67931eb1b..13332dbf291d 100644 ---- a/net/netfilter/xt_socket.c -+++ b/net/netfilter/xt_socket.c -@@ -243,12 +243,13 @@ static int - extract_icmp6_fields(const struct sk_buff *skb, - unsigned int outside_hdrlen, - int *protocol, -- struct in6_addr **raddr, -- struct in6_addr **laddr, -+ const struct in6_addr **raddr, -+ const struct in6_addr **laddr, - __be16 *rport, -- __be16 *lport) -+ __be16 *lport, -+ struct ipv6hdr *ipv6_var) - { -- struct ipv6hdr *inside_iph, _inside_iph; -+ const struct ipv6hdr *inside_iph; - struct icmp6hdr *icmph, _icmph; - __be16 *ports, _ports[2]; - u8 inside_nexthdr; -@@ -263,12 +264,14 @@ extract_icmp6_fields(const struct sk_buff *skb, - if (icmph->icmp6_type & ICMPV6_INFOMSG_MASK) - return 1; - -- inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), sizeof(_inside_iph), &_inside_iph); -+ inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), -+ sizeof(*ipv6_var), ipv6_var); - if (inside_iph == NULL) - return 1; - inside_nexthdr = inside_iph->nexthdr; - -- inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph), -+ inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + -+ sizeof(*ipv6_var), - &inside_nexthdr, &inside_fragoff); - if (inside_hdrlen < 0) - return 1; /* hjm: Packet has no/incomplete transport layer headers. */ -@@ -315,10 +318,10 @@ xt_socket_get_sock_v6(struct net *net, const u8 protocol, - static bool - socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) - { -- struct ipv6hdr *iph = ipv6_hdr(skb); -+ struct ipv6hdr ipv6_var, *iph = ipv6_hdr(skb); - struct udphdr _hdr, *hp = NULL; - struct sock *sk = skb->sk; -- struct in6_addr *daddr = NULL, *saddr = NULL; -+ const struct in6_addr *daddr = NULL, *saddr = NULL; - __be16 uninitialized_var(dport), uninitialized_var(sport); - int thoff = 0, uninitialized_var(tproto); - const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo; -@@ -342,7 +345,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) - - } else if (tproto == IPPROTO_ICMPV6) { - if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr, -- &sport, &dport)) -+ &sport, &dport, &ipv6_var)) - return false; - } else { - return false; -diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c -index a817705ce2d0..dba8d0864f18 100644 ---- a/net/rds/iw_rdma.c -+++ b/net/rds/iw_rdma.c -@@ -88,7 +88,9 @@ static unsigned int rds_iw_unmap_fastreg_list(struct rds_iw_mr_pool *pool, - int *unpinned); - static void rds_iw_destroy_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr); - --static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwdev, struct rdma_cm_id **cm_id) -+static int rds_iw_get_device(struct sockaddr_in *src, struct sockaddr_in *dst, -+ struct rds_iw_device **rds_iwdev, -+ struct rdma_cm_id **cm_id) - { - struct rds_iw_device *iwdev; - struct rds_iw_cm_id *i_cm_id; -@@ -112,15 +114,15 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd - src_addr->sin_port, - dst_addr->sin_addr.s_addr, - dst_addr->sin_port, -- rs->rs_bound_addr, -- rs->rs_bound_port, -- rs->rs_conn_addr, -- rs->rs_conn_port); -+ src->sin_addr.s_addr, -+ src->sin_port, -+ dst->sin_addr.s_addr, -+ dst->sin_port); - #ifdef WORKING_TUPLE_DETECTION -- if (src_addr->sin_addr.s_addr == rs->rs_bound_addr && -- src_addr->sin_port == rs->rs_bound_port && -- dst_addr->sin_addr.s_addr == rs->rs_conn_addr && -- dst_addr->sin_port == rs->rs_conn_port) { -+ if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr && -+ src_addr->sin_port == src->sin_port && -+ dst_addr->sin_addr.s_addr == dst->sin_addr.s_addr && -+ dst_addr->sin_port == dst->sin_port) { - #else - /* FIXME - needs to compare the local and remote - * ipaddr/port tuple, but the ipaddr is the only -@@ -128,7 +130,7 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd - * zero'ed. It doesn't appear to be properly populated - * during connection setup... - */ -- if (src_addr->sin_addr.s_addr == rs->rs_bound_addr) { -+ if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr) { - #endif - spin_unlock_irq(&iwdev->spinlock); - *rds_iwdev = iwdev; -@@ -180,19 +182,13 @@ int rds_iw_update_cm_id(struct rds_iw_device *rds_iwdev, struct rdma_cm_id *cm_i - { - struct sockaddr_in *src_addr, *dst_addr; - struct rds_iw_device *rds_iwdev_old; -- struct rds_sock rs; - struct rdma_cm_id *pcm_id; - int rc; - - src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr; - dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr; - -- rs.rs_bound_addr = src_addr->sin_addr.s_addr; -- rs.rs_bound_port = src_addr->sin_port; -- rs.rs_conn_addr = dst_addr->sin_addr.s_addr; -- rs.rs_conn_port = dst_addr->sin_port; -- -- rc = rds_iw_get_device(&rs, &rds_iwdev_old, &pcm_id); -+ rc = rds_iw_get_device(src_addr, dst_addr, &rds_iwdev_old, &pcm_id); - if (rc) - rds_iw_remove_cm_id(rds_iwdev, cm_id); - -@@ -598,9 +594,17 @@ void *rds_iw_get_mr(struct scatterlist *sg, unsigned long nents, - struct rds_iw_device *rds_iwdev; - struct rds_iw_mr *ibmr = NULL; - struct rdma_cm_id *cm_id; -+ struct sockaddr_in src = { -+ .sin_addr.s_addr = rs->rs_bound_addr, -+ .sin_port = rs->rs_bound_port, -+ }; -+ struct sockaddr_in dst = { -+ .sin_addr.s_addr = rs->rs_conn_addr, -+ .sin_port = rs->rs_conn_port, -+ }; - int ret; - -- ret = rds_iw_get_device(rs, &rds_iwdev, &cm_id); -+ ret = rds_iw_get_device(&src, &dst, &rds_iwdev, &cm_id); - if (ret || !cm_id) { - ret = -ENODEV; - goto out; -diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c -index 34b5490dde65..4949f753686c 100644 ---- a/net/rxrpc/ar-recvmsg.c -+++ b/net/rxrpc/ar-recvmsg.c -@@ -87,7 +87,7 @@ int rxrpc_recvmsg(struct kiocb *iocb, struct socket *sock, - if (!skb) { - /* nothing remains on the queue */ - if (copied && -- (msg->msg_flags & MSG_PEEK || timeo == 0)) -+ (flags & MSG_PEEK || timeo == 0)) - goto out; - - /* wait for a message to turn up */ -diff --git a/sound/core/control.c b/sound/core/control.c -index 98a29b26c5f4..f2082a35b890 100644 ---- a/sound/core/control.c -+++ b/sound/core/control.c -@@ -1168,6 +1168,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, - - if (info->count < 1) - return -EINVAL; -+ if (!*info->id.name) -+ return -EINVAL; -+ if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name)) -+ return -EINVAL; - access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : - (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE| - SNDRV_CTL_ELEM_ACCESS_INACTIVE| -diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c -index d9a09bdd09db..9a23bdea97d8 100644 ---- a/sound/pci/hda/hda_generic.c -+++ b/sound/pci/hda/hda_generic.c -@@ -653,12 +653,45 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, - return val; - } - -+/* is this a stereo widget or a stereo-to-mono mix? */ -+static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, int dir) -+{ -+ unsigned int wcaps = get_wcaps(codec, nid); -+ hda_nid_t conn; -+ -+ if (wcaps & AC_WCAP_STEREO) -+ return true; -+ if (dir != HDA_INPUT || get_wcaps_type(wcaps) != AC_WID_AUD_MIX) -+ return false; -+ if (snd_hda_get_num_conns(codec, nid) != 1) -+ return false; -+ if (snd_hda_get_connections(codec, nid, &conn, 1) < 0) -+ return false; -+ return !!(get_wcaps(codec, conn) & AC_WCAP_STEREO); -+} -+ - /* initialize the amp value (only at the first time) */ - static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) - { - unsigned int caps = query_amp_caps(codec, nid, dir); - int val = get_amp_val_to_activate(codec, nid, dir, caps, false); -- snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); -+ -+ if (is_stereo_amps(codec, nid, dir)) -+ snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); -+ else -+ snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val); -+} -+ -+/* update the amp, doing in stereo or mono depending on NID */ -+static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx, -+ unsigned int mask, unsigned int val) -+{ -+ if (is_stereo_amps(codec, nid, dir)) -+ return snd_hda_codec_amp_stereo(codec, nid, dir, idx, -+ mask, val); -+ else -+ return snd_hda_codec_amp_update(codec, nid, 0, dir, idx, -+ mask, val); - } - - /* calculate amp value mask we can modify; -@@ -698,7 +731,7 @@ static void activate_amp(struct hda_codec *codec, hda_nid_t nid, int dir, - return; - - val &= mask; -- snd_hda_codec_amp_stereo(codec, nid, dir, idx, mask, val); -+ update_amp(codec, nid, dir, idx, mask, val); - } - - static void activate_amp_out(struct hda_codec *codec, struct nid_path *path, -@@ -4337,13 +4370,11 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) - has_amp = nid_has_mute(codec, mix, HDA_INPUT); - for (i = 0; i < nums; i++) { - if (has_amp) -- snd_hda_codec_amp_stereo(codec, mix, -- HDA_INPUT, i, -- 0xff, HDA_AMP_MUTE); -+ update_amp(codec, mix, HDA_INPUT, i, -+ 0xff, HDA_AMP_MUTE); - else if (nid_has_volume(codec, conn[i], HDA_OUTPUT)) -- snd_hda_codec_amp_stereo(codec, conn[i], -- HDA_OUTPUT, 0, -- 0xff, HDA_AMP_MUTE); -+ update_amp(codec, conn[i], HDA_OUTPUT, 0, -+ 0xff, HDA_AMP_MUTE); - } - } - -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 2f3059b50ffa..84e8879cc372 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -959,7 +959,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, - } - } - -- if (!bus->no_response_fallback) -+ if (bus->no_response_fallback) - return -1; - - if (!chip->polling_mode && chip->poll_count < 2) { -diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c -index ce5a6da83419..05e19f78b4cb 100644 ---- a/sound/pci/hda/hda_proc.c -+++ b/sound/pci/hda/hda_proc.c -@@ -134,13 +134,38 @@ static void print_amp_caps(struct snd_info_buffer *buffer, - (caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT); - } - -+/* is this a stereo widget or a stereo-to-mono mix? */ -+static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, -+ int dir, unsigned int wcaps, int indices) -+{ -+ hda_nid_t conn; -+ -+ if (wcaps & AC_WCAP_STEREO) -+ return true; -+ /* check for a stereo-to-mono mix; it must be: -+ * only a single connection, only for input, and only a mixer widget -+ */ -+ if (indices != 1 || dir != HDA_INPUT || -+ get_wcaps_type(wcaps) != AC_WID_AUD_MIX) -+ return false; -+ -+ if (snd_hda_get_raw_connections(codec, nid, &conn, 1) < 0) -+ return false; -+ /* the connection source is a stereo? */ -+ wcaps = snd_hda_param_read(codec, conn, AC_PAR_AUDIO_WIDGET_CAP); -+ return !!(wcaps & AC_WCAP_STEREO); -+} -+ - static void print_amp_vals(struct snd_info_buffer *buffer, - struct hda_codec *codec, hda_nid_t nid, -- int dir, int stereo, int indices) -+ int dir, unsigned int wcaps, int indices) - { - unsigned int val; -+ bool stereo; - int i; - -+ stereo = is_stereo_amps(codec, nid, dir, wcaps, indices); -+ - dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT; - for (i = 0; i < indices; i++) { - snd_iprintf(buffer, " ["); -@@ -757,12 +782,10 @@ static void print_codec_info(struct snd_info_entry *entry, - (codec->single_adc_amp && - wid_type == AC_WID_AUD_IN)) - print_amp_vals(buffer, codec, nid, HDA_INPUT, -- wid_caps & AC_WCAP_STEREO, -- 1); -+ wid_caps, 1); - else - print_amp_vals(buffer, codec, nid, HDA_INPUT, -- wid_caps & AC_WCAP_STEREO, -- conn_len); -+ wid_caps, conn_len); - } - if (wid_caps & AC_WCAP_OUT_AMP) { - snd_iprintf(buffer, " Amp-Out caps: "); -@@ -771,11 +794,10 @@ static void print_codec_info(struct snd_info_entry *entry, - if (wid_type == AC_WID_PIN && - codec->pin_amp_workaround) - print_amp_vals(buffer, codec, nid, HDA_OUTPUT, -- wid_caps & AC_WCAP_STEREO, -- conn_len); -+ wid_caps, conn_len); - else - print_amp_vals(buffer, codec, nid, HDA_OUTPUT, -- wid_caps & AC_WCAP_STEREO, 1); -+ wid_caps, 1); - } - - switch (wid_type) { -diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c -index fc492ac24caa..51e208022cc8 100644 ---- a/sound/pci/hda/patch_cirrus.c -+++ b/sound/pci/hda/patch_cirrus.c -@@ -396,6 +396,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = { - SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), - SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), - SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), -+ SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81), - SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42), - SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), - {} /* terminator */ -@@ -587,6 +588,7 @@ static int patch_cs420x(struct hda_codec *codec) - return -ENOMEM; - - spec->gen.automute_hook = cs_automute; -+ codec->single_adc_amp = 1; - - snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, - cs420x_fixups); -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index ffc19464b978..976493c4a695 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -3232,6 +3232,7 @@ enum { - CXT_PINCFG_LENOVO_TP410, - CXT_PINCFG_LEMOTE_A1004, - CXT_PINCFG_LEMOTE_A1205, -+ CXT_PINCFG_COMPAQ_CQ60, - CXT_FIXUP_STEREO_DMIC, - CXT_FIXUP_INC_MIC_BOOST, - CXT_FIXUP_HEADPHONE_MIC_PIN, -@@ -3368,6 +3369,15 @@ static const struct hda_fixup cxt_fixups[] = { - .type = HDA_FIXUP_PINS, - .v.pins = cxt_pincfg_lemote, - }, -+ [CXT_PINCFG_COMPAQ_CQ60] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ /* 0x17 was falsely set up as a mic, it should 0x1d */ -+ { 0x17, 0x400001f0 }, -+ { 0x1d, 0x97a70120 }, -+ { } -+ } -+ }, - [CXT_FIXUP_STEREO_DMIC] = { - .type = HDA_FIXUP_FUNC, - .v.func = cxt_fixup_stereo_dmic, -@@ -3411,6 +3421,7 @@ static const struct hda_fixup cxt_fixups[] = { - }; - - static const struct snd_pci_quirk cxt5051_fixups[] = { -+ SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), - {} - }; -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index 83bddbdb90e9..5293b5ac8b9d 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -1773,6 +1773,36 @@ YAMAHA_DEVICE(0x7010, "UB99"), - } - } - }, -+{ -+ USB_DEVICE(0x0582, 0x0159), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ /* .vendor_name = "Roland", */ -+ /* .product_name = "UA-22", */ -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 0, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_MIDI_FIXED_ENDPOINT, -+ .data = & (const struct snd_usb_midi_endpoint_info) { -+ .out_cables = 0x0001, -+ .in_cables = 0x0001 -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, - /* this catches most recent vendor-specific Roland devices */ - { - .match_flags = USB_DEVICE_ID_MATCH_VENDOR | diff --git a/patch/kernel/neo-patch-3.14.37-38 b/patch/kernel/neo-patch-3.14.37-38 deleted file mode 100644 index 75314290a..000000000 --- a/patch/kernel/neo-patch-3.14.37-38 +++ /dev/null @@ -1,1016 +0,0 @@ -diff --git a/Makefile b/Makefile -index c24acc0d34a1..f09e19d2cc4f 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 37 -+SUBLEVEL = 38 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h -index a9eee33dfa62..101a42bde728 100644 ---- a/arch/arm64/include/asm/mmu_context.h -+++ b/arch/arm64/include/asm/mmu_context.h -@@ -151,6 +151,15 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, - { - unsigned int cpu = smp_processor_id(); - -+ /* -+ * init_mm.pgd does not contain any user mappings and it is always -+ * active for kernel addresses in TTBR1. Just set the reserved TTBR0. -+ */ -+ if (next == &init_mm) { -+ cpu_set_reserved_ttbr0(); -+ return; -+ } -+ - if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) - check_and_switch_context(next, tsk); - } -diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi -index 1382fec9e8c5..7fcb1ac0f232 100644 ---- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi -+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi -@@ -50,6 +50,7 @@ ethernet@b0000 { - fsl,num_tx_queues = <0x8>; - fsl,magic-packet; - local-mac-address = [ 00 00 00 00 00 00 ]; -+ ranges; - - queue-group@b0000 { - #address-cells = <1>; -diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi -index 221cd2ea5b31..9f25427c1527 100644 ---- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi -+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi -@@ -50,6 +50,7 @@ ethernet@b1000 { - fsl,num_tx_queues = <0x8>; - fsl,magic-packet; - local-mac-address = [ 00 00 00 00 00 00 ]; -+ ranges; - - queue-group@b1000 { - #address-cells = <1>; -diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi -index 61456c317609..cd7c318ab131 100644 ---- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi -+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi -@@ -49,6 +49,7 @@ ethernet@b2000 { - fsl,num_tx_queues = <0x8>; - fsl,magic-packet; - local-mac-address = [ 00 00 00 00 00 00 ]; -+ ranges; - - queue-group@b2000 { - #address-cells = <1>; -diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S -index 38d507306a11..5193116eadc0 100644 ---- a/arch/powerpc/kernel/exceptions-64s.S -+++ b/arch/powerpc/kernel/exceptions-64s.S -@@ -1422,7 +1422,7 @@ machine_check_handle_early: - bne 9f /* continue in V mode if we are. */ - - 5: --#ifdef CONFIG_KVM_BOOK3S_64_HV -+#ifdef CONFIG_KVM_BOOK3S_64_HANDLER - /* - * We are coming from kernel context. Check if we are coming from - * guest. if yes, then we can continue. We will fall through -diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c -index cde4e0a095ae..bf3829242aff 100644 ---- a/arch/powerpc/platforms/pseries/mobility.c -+++ b/arch/powerpc/platforms/pseries/mobility.c -@@ -24,10 +24,10 @@ - static struct kobject *mobility_kobj; - - struct update_props_workarea { -- u32 phandle; -- u32 state; -- u64 reserved; -- u32 nprops; -+ __be32 phandle; -+ __be32 state; -+ __be64 reserved; -+ __be32 nprops; - } __packed; - - #define NODE_ACTION_MASK 0xff000000 -@@ -53,11 +53,11 @@ static int mobility_rtas_call(int token, char *buf, s32 scope) - return rc; - } - --static int delete_dt_node(u32 phandle) -+static int delete_dt_node(__be32 phandle) - { - struct device_node *dn; - -- dn = of_find_node_by_phandle(phandle); -+ dn = of_find_node_by_phandle(be32_to_cpu(phandle)); - if (!dn) - return -ENOENT; - -@@ -126,7 +126,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop, - return 0; - } - --static int update_dt_node(u32 phandle, s32 scope) -+static int update_dt_node(__be32 phandle, s32 scope) - { - struct update_props_workarea *upwa; - struct device_node *dn; -@@ -135,6 +135,7 @@ static int update_dt_node(u32 phandle, s32 scope) - char *prop_data; - char *rtas_buf; - int update_properties_token; -+ u32 nprops; - u32 vd; - - update_properties_token = rtas_token("ibm,update-properties"); -@@ -145,7 +146,7 @@ static int update_dt_node(u32 phandle, s32 scope) - if (!rtas_buf) - return -ENOMEM; - -- dn = of_find_node_by_phandle(phandle); -+ dn = of_find_node_by_phandle(be32_to_cpu(phandle)); - if (!dn) { - kfree(rtas_buf); - return -ENOENT; -@@ -161,6 +162,7 @@ static int update_dt_node(u32 phandle, s32 scope) - break; - - prop_data = rtas_buf + sizeof(*upwa); -+ nprops = be32_to_cpu(upwa->nprops); - - /* On the first call to ibm,update-properties for a node the - * the first property value descriptor contains an empty -@@ -169,17 +171,17 @@ static int update_dt_node(u32 phandle, s32 scope) - */ - if (*prop_data == 0) { - prop_data++; -- vd = *(u32 *)prop_data; -+ vd = be32_to_cpu(*(__be32 *)prop_data); - prop_data += vd + sizeof(vd); -- upwa->nprops--; -+ nprops--; - } - -- for (i = 0; i < upwa->nprops; i++) { -+ for (i = 0; i < nprops; i++) { - char *prop_name; - - prop_name = prop_data; - prop_data += strlen(prop_name) + 1; -- vd = *(u32 *)prop_data; -+ vd = be32_to_cpu(*(__be32 *)prop_data); - prop_data += sizeof(vd); - - switch (vd) { -@@ -211,13 +213,13 @@ static int update_dt_node(u32 phandle, s32 scope) - return 0; - } - --static int add_dt_node(u32 parent_phandle, u32 drc_index) -+static int add_dt_node(__be32 parent_phandle, __be32 drc_index) - { - struct device_node *dn; - struct device_node *parent_dn; - int rc; - -- parent_dn = of_find_node_by_phandle(parent_phandle); -+ parent_dn = of_find_node_by_phandle(be32_to_cpu(parent_phandle)); - if (!parent_dn) - return -ENOENT; - -@@ -236,7 +238,7 @@ static int add_dt_node(u32 parent_phandle, u32 drc_index) - int pseries_devicetree_update(s32 scope) - { - char *rtas_buf; -- u32 *data; -+ __be32 *data; - int update_nodes_token; - int rc; - -@@ -253,17 +255,17 @@ int pseries_devicetree_update(s32 scope) - if (rc && rc != 1) - break; - -- data = (u32 *)rtas_buf + 4; -- while (*data & NODE_ACTION_MASK) { -+ data = (__be32 *)rtas_buf + 4; -+ while (be32_to_cpu(*data) & NODE_ACTION_MASK) { - int i; -- u32 action = *data & NODE_ACTION_MASK; -- int node_count = *data & NODE_COUNT_MASK; -+ u32 action = be32_to_cpu(*data) & NODE_ACTION_MASK; -+ u32 node_count = be32_to_cpu(*data) & NODE_COUNT_MASK; - - data++; - - for (i = 0; i < node_count; i++) { -- u32 phandle = *data++; -- u32 drc_index; -+ __be32 phandle = *data++; -+ __be32 drc_index; - - switch (action) { - case DELETE_DT_NODE: -diff --git a/drivers/clocksource/time-efm32.c b/drivers/clocksource/time-efm32.c -index 1a6205b7bed3..35b016100673 100644 ---- a/drivers/clocksource/time-efm32.c -+++ b/drivers/clocksource/time-efm32.c -@@ -225,12 +225,12 @@ static int __init efm32_clockevent_init(struct device_node *np) - clock_event_ddata.base = base; - clock_event_ddata.periodic_top = DIV_ROUND_CLOSEST(rate, 1024 * HZ); - -- setup_irq(irq, &efm32_clock_event_irq); -- - clockevents_config_and_register(&clock_event_ddata.evtdev, - DIV_ROUND_CLOSEST(rate, 1024), - 0xf, 0xffff); - -+ setup_irq(irq, &efm32_clock_event_irq); -+ - return 0; - - err_get_irq: -diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c -index deebcd6469fc..4f0f3610371a 100644 ---- a/drivers/clocksource/timer-sun5i.c -+++ b/drivers/clocksource/timer-sun5i.c -@@ -172,10 +172,6 @@ static void __init sun5i_timer_init(struct device_node *node) - - ticks_per_jiffy = DIV_ROUND_UP(rate, HZ); - -- ret = setup_irq(irq, &sun5i_timer_irq); -- if (ret) -- pr_warn("failed to setup irq %d\n", irq); -- - /* Enable timer0 interrupt */ - val = readl(timer_base + TIMER_IRQ_EN_REG); - writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); -@@ -185,6 +181,10 @@ static void __init sun5i_timer_init(struct device_node *node) - - clockevents_config_and_register(&sun5i_clockevent, rate, - TIMER_SYNC_TICKS, 0xffffffff); -+ -+ ret = setup_irq(irq, &sun5i_timer_irq); -+ if (ret) -+ pr_warn("failed to setup irq %d\n", irq); - } - CLOCKSOURCE_OF_DECLARE(sun5i_a13, "allwinner,sun5i-a13-hstimer", - sun5i_timer_init); -diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c -index 453822cc4f9d..fe8b0c991518 100644 ---- a/drivers/dma/dw/platform.c -+++ b/drivers/dma/dw/platform.c -@@ -48,6 +48,8 @@ static bool dw_dma_of_filter(struct dma_chan *chan, void *param) - return true; - } - -+#define DRV_NAME "dw_dmac" -+ - static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec, - struct of_dma *ofdma) - { -@@ -293,7 +295,7 @@ static struct platform_driver dw_driver = { - .remove = dw_remove, - .shutdown = dw_shutdown, - .driver = { -- .name = "dw_dmac", -+ .name = DRV_NAME, - .pm = &dw_dev_pm_ops, - .of_match_table = of_match_ptr(dw_dma_of_id_table), - .acpi_match_table = ACPI_PTR(dw_dma_acpi_id_table), -@@ -314,3 +316,4 @@ module_exit(dw_exit); - - MODULE_LICENSE("GPL v2"); - MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller platform driver"); -+MODULE_ALIAS("platform:" DRV_NAME); -diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c -index d2a8d64f8526..080e767250d3 100644 ---- a/drivers/md/dm-io.c -+++ b/drivers/md/dm-io.c -@@ -291,9 +291,16 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, - struct request_queue *q = bdev_get_queue(where->bdev); - unsigned short logical_block_size = queue_logical_block_size(q); - sector_t num_sectors; -+ unsigned int uninitialized_var(special_cmd_max_sectors); - -- /* Reject unsupported discard requests */ -- if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) { -+ /* -+ * Reject unsupported discard and write same requests. -+ */ -+ if (rw & REQ_DISCARD) -+ special_cmd_max_sectors = q->limits.max_discard_sectors; -+ else if (rw & REQ_WRITE_SAME) -+ special_cmd_max_sectors = q->limits.max_write_same_sectors; -+ if ((rw & (REQ_DISCARD | REQ_WRITE_SAME)) && special_cmd_max_sectors == 0) { - dec_count(io, region, -EOPNOTSUPP); - return; - } -@@ -319,7 +326,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, - store_io_and_region_in_bio(bio, io, region); - - if (rw & REQ_DISCARD) { -- num_sectors = min_t(sector_t, q->limits.max_discard_sectors, remaining); -+ num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining); - bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; - remaining -= num_sectors; - } else if (rw & REQ_WRITE_SAME) { -@@ -328,7 +335,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, - */ - dp->get_page(dp, &page, &len, &offset); - bio_add_page(bio, page, logical_block_size, offset); -- num_sectors = min_t(sector_t, q->limits.max_write_same_sectors, remaining); -+ num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining); - bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; - - offset = 0; -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index 1582c3dac3ac..e40059143272 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -2352,10 +2352,16 @@ static void __dm_destroy(struct mapped_device *md, bool wait) - set_bit(DMF_FREEING, &md->flags); - spin_unlock(&_minor_lock); - -+ /* -+ * Take suspend_lock so that presuspend and postsuspend methods -+ * do not race with internal suspend. -+ */ -+ mutex_lock(&md->suspend_lock); - if (!dm_suspended_md(md)) { - dm_table_presuspend_targets(map); - dm_table_postsuspend_targets(map); - } -+ mutex_unlock(&md->suspend_lock); - - /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ - dm_put_live_table(md, srcu_idx); -diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c -index 38917a822335..2df3cbc968d1 100644 ---- a/drivers/mfd/kempld-core.c -+++ b/drivers/mfd/kempld-core.c -@@ -629,7 +629,7 @@ static int __init kempld_init(void) - if (force_device_id[0]) { - for (id = kempld_dmi_table; id->matches[0].slot != DMI_NONE; id++) - if (strstr(id->ident, force_device_id)) -- if (id->callback && id->callback(id)) -+ if (id->callback && !id->callback(id)) - break; - if (id->matches[0].slot == DMI_NONE) - return -ENODEV; -diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c -index 9339cccfe05a..ad0e71c7a607 100644 ---- a/drivers/net/ethernet/amd/pcnet32.c -+++ b/drivers/net/ethernet/amd/pcnet32.c -@@ -1516,7 +1516,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - { - struct pcnet32_private *lp; - int i, media; -- int fdx, mii, fset, dxsuflo; -+ int fdx, mii, fset, dxsuflo, sram; - int chip_version; - char *chipname; - struct net_device *dev; -@@ -1553,7 +1553,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - } - - /* initialize variables */ -- fdx = mii = fset = dxsuflo = 0; -+ fdx = mii = fset = dxsuflo = sram = 0; - chip_version = (chip_version >> 12) & 0xffff; - - switch (chip_version) { -@@ -1586,6 +1586,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - chipname = "PCnet/FAST III 79C973"; /* PCI */ - fdx = 1; - mii = 1; -+ sram = 1; - break; - case 0x2626: - chipname = "PCnet/Home 79C978"; /* PCI */ -@@ -1609,6 +1610,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - chipname = "PCnet/FAST III 79C975"; /* PCI */ - fdx = 1; - mii = 1; -+ sram = 1; - break; - case 0x2628: - chipname = "PCnet/PRO 79C976"; -@@ -1637,6 +1639,31 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - dxsuflo = 1; - } - -+ /* -+ * The Am79C973/Am79C975 controllers come with 12K of SRAM -+ * which we can use for the Tx/Rx buffers but most importantly, -+ * the use of SRAM allow us to use the BCR18:NOUFLO bit to avoid -+ * Tx fifo underflows. -+ */ -+ if (sram) { -+ /* -+ * The SRAM is being configured in two steps. First we -+ * set the SRAM size in the BCR25:SRAM_SIZE bits. According -+ * to the datasheet, each bit corresponds to a 512-byte -+ * page so we can have at most 24 pages. The SRAM_SIZE -+ * holds the value of the upper 8 bits of the 16-bit SRAM size. -+ * The low 8-bits start at 0x00 and end at 0xff. So the -+ * address range is from 0x0000 up to 0x17ff. Therefore, -+ * the SRAM_SIZE is set to 0x17. The next step is to set -+ * the BCR26:SRAM_BND midway through so the Tx and Rx -+ * buffers can share the SRAM equally. -+ */ -+ a->write_bcr(ioaddr, 25, 0x17); -+ a->write_bcr(ioaddr, 26, 0xc); -+ /* And finally enable the NOUFLO bit */ -+ a->write_bcr(ioaddr, 18, a->read_bcr(ioaddr, 18) | (1 << 11)); -+ } -+ - dev = alloc_etherdev(sizeof(*lp)); - if (!dev) { - ret = -ENOMEM; -diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -index a04174607e97..4a3b8b72c8af 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -@@ -594,7 +594,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, - - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - if (ret) -- goto out_remove_mac; -+ goto out_release; - - iwl_mvm_power_disable(mvm, vif); - -diff --git a/drivers/of/irq.c b/drivers/of/irq.c -index 48f20ff1add9..bbff99dcbaea 100644 ---- a/drivers/of/irq.c -+++ b/drivers/of/irq.c -@@ -290,7 +290,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar - struct device_node *p; - const __be32 *intspec, *tmp, *addr; - u32 intsize, intlen; -- int i, res = -EINVAL; -+ int i, res; - - pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); - -@@ -323,15 +323,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar - - /* Get size of interrupt specifier */ - tmp = of_get_property(p, "#interrupt-cells", NULL); -- if (tmp == NULL) -+ if (tmp == NULL) { -+ res = -EINVAL; - goto out; -+ } - intsize = be32_to_cpu(*tmp); - - pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); - - /* Check index */ -- if ((index + 1) * intsize > intlen) -+ if ((index + 1) * intsize > intlen) { -+ res = -EINVAL; - goto out; -+ } - - /* Copy intspec into irq structure */ - intspec += index * intsize; -diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c -index 34d56f7864d6..86592dd24da5 100644 ---- a/drivers/phy/phy-core.c -+++ b/drivers/phy/phy-core.c -@@ -50,7 +50,9 @@ static void devm_phy_consume(struct device *dev, void *res) - - static int devm_phy_match(struct device *dev, void *res, void *match_data) - { -- return res == match_data; -+ struct phy **phy = res; -+ -+ return *phy == match_data; - } - - static struct phy *phy_lookup(struct device *device, const char *port) -diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -index 9d81f7693f99..1817f3f2b02d 100644 ---- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c -+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -@@ -1515,7 +1515,7 @@ static int tcm_qla2xxx_check_initiator_node_acl( - /* - * Finally register the new FC Nexus with TCM - */ -- __transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess); -+ transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess); - - return 0; - } -diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c -index fbf3b22efe5a..d6563ec700d4 100644 ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -846,13 +846,14 @@ void spi_finalize_current_message(struct spi_master *master) - "failed to unprepare message: %d\n", ret); - } - } -+ -+ trace_spi_message_done(mesg); -+ - master->cur_msg_prepared = false; - - mesg->state = NULL; - if (mesg->complete) - mesg->complete(mesg->context); -- -- trace_spi_message_done(mesg); - } - EXPORT_SYMBOL_GPL(spi_finalize_current_message); - -diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c -index edb1b2768b17..dbd9d44919ac 100644 ---- a/drivers/staging/vt6655/rf.c -+++ b/drivers/staging/vt6655/rf.c -@@ -936,6 +936,7 @@ bool RFbSetPower( - break; - case RATE_6M: - case RATE_9M: -+ case RATE_12M: - case RATE_18M: - byPwr = pDevice->abyOFDMPwrTbl[uCH]; - if (pDevice->byRFType == RF_UW2452) { -diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c -index 1e8f64bff03c..2dc48d4ff433 100644 ---- a/drivers/staging/vt6656/rf.c -+++ b/drivers/staging/vt6656/rf.c -@@ -752,6 +752,7 @@ int RFbSetPower(struct vnt_private *priv, u32 rate, u32 channel) - break; - case RATE_6M: - case RATE_9M: -+ case RATE_12M: - case RATE_18M: - case RATE_24M: - case RATE_36M: -diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c -index e415af32115a..c67d3795db4a 100644 ---- a/drivers/target/tcm_fc/tfc_io.c -+++ b/drivers/target/tcm_fc/tfc_io.c -@@ -346,7 +346,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) - ep = fc_seq_exch(seq); - if (ep) { - lport = ep->lp; -- if (lport && (ep->xid <= lport->lro_xid)) -+ if (lport && (ep->xid <= lport->lro_xid)) { - /* - * "ddp_done" trigger invalidation of HW - * specific DDP context -@@ -361,6 +361,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) - * identified using ep->xid) - */ - cmd->was_ddp_setup = 0; -+ } - } - } - } -diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c -index 6e560d56094b..754fdf8c6356 100644 ---- a/fs/hfsplus/brec.c -+++ b/fs/hfsplus/brec.c -@@ -131,13 +131,16 @@ skip: - hfs_bnode_write(node, entry, data_off + key_len, entry_len); - hfs_bnode_dump(node); - -- if (new_node) { -- /* update parent key if we inserted a key -- * at the start of the first node -- */ -- if (!rec && new_node != node) -- hfs_brec_update_parent(fd); -+ /* -+ * update parent key if we inserted a key -+ * at the start of the node and it is not the new node -+ */ -+ if (!rec && new_node != node) { -+ hfs_bnode_read_key(node, fd->search_key, data_off + size); -+ hfs_brec_update_parent(fd); -+ } - -+ if (new_node) { - hfs_bnode_put(fd->bnode); - if (!new_node->parent) { - hfs_btree_inc_height(tree); -@@ -168,9 +171,6 @@ skip: - goto again; - } - -- if (!rec) -- hfs_brec_update_parent(fd); -- - return 0; - } - -@@ -370,6 +370,8 @@ again: - if (IS_ERR(parent)) - return PTR_ERR(parent); - __hfs_brec_find(parent, fd, hfs_find_rec_by_key); -+ if (fd->record < 0) -+ return -ENOENT; - hfs_bnode_dump(parent); - rec = fd->record; - -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 69cffb46db17..60146febb9b3 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -4232,6 +4232,13 @@ static void perf_pending_event(struct irq_work *entry) - { - struct perf_event *event = container_of(entry, - struct perf_event, pending); -+ int rctx; -+ -+ rctx = perf_swevent_get_recursion_context(); -+ /* -+ * If we 'fail' here, that's OK, it means recursion is already disabled -+ * and we won't recurse 'further'. -+ */ - - if (event->pending_disable) { - event->pending_disable = 0; -@@ -4242,6 +4249,9 @@ static void perf_pending_event(struct irq_work *entry) - event->pending_wakeup = 0; - perf_event_wakeup(event); - } -+ -+ if (rctx >= 0) -+ perf_swevent_put_recursion_context(rctx); - } - - /* -diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h -index bf7a1bbb975f..e278c64572de 100644 ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -57,13 +57,24 @@ struct ieee80211_local; - #define IEEE80211_UNSET_POWER_LEVEL INT_MIN - - /* -- * Some APs experience problems when working with U-APSD. Decrease the -- * probability of that happening by using legacy mode for all ACs but VO. -- * The AP that caused us trouble was a Cisco 4410N. It ignores our -- * setting, and always treats non-VO ACs as legacy. -+ * Some APs experience problems when working with U-APSD. Decreasing the -+ * probability of that happening by using legacy mode for all ACs but VO isn't -+ * enough. -+ * -+ * Cisco 4410N originally forced us to enable VO by default only because it -+ * treated non-VO ACs as legacy. -+ * -+ * However some APs (notably Netgear R7000) silently reclassify packets to -+ * different ACs. Since u-APSD ACs require trigger frames for frame retrieval -+ * clients would never see some frames (e.g. ARP responses) or would fetch them -+ * accidentally after a long time. -+ * -+ * It makes little sense to enable u-APSD queues by default because it needs -+ * userspace applications to be aware of it to actually take advantage of the -+ * possible additional powersavings. Implicitly depending on driver autotrigger -+ * frame support doesn't make much sense. - */ --#define IEEE80211_DEFAULT_UAPSD_QUEUES \ -- IEEE80211_WMM_IE_STA_QOSINFO_AC_VO -+#define IEEE80211_DEFAULT_UAPSD_QUEUES 0 - - #define IEEE80211_DEFAULT_MAX_SP_LEN \ - IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index 815ca56b39e7..9abb445ea261 100644 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2107,6 +2107,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) - hdr = (struct ieee80211_hdr *) skb->data; - mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - -+ if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) -+ return RX_DROP_MONITOR; -+ - /* frame is in RMC, don't forward */ - if (ieee80211_is_data(hdr->frame_control) && - is_multicast_ether_addr(hdr->addr1) && -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index 18d73df72531..c260243dbe07 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -4190,6 +4190,16 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) - if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) - return -EINVAL; - -+ /* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT -+ * as userspace might just pass through the capabilities from the IEs -+ * directly, rather than enforcing this restriction and returning an -+ * error in this case. -+ */ -+ if (!(params.sta_flags_set & BIT(NL80211_STA_FLAG_WME))) { -+ params.ht_capa = NULL; -+ params.vht_capa = NULL; -+ } -+ - /* When you run into this, adjust the code below for the new flag */ - BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 7); - -diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c -index f78b27a7c461..23454e9a5d3a 100644 ---- a/sound/soc/codecs/adav80x.c -+++ b/sound/soc/codecs/adav80x.c -@@ -319,7 +319,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); -- unsigned int deemph = ucontrol->value.enumerated.item[0]; -+ unsigned int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -@@ -335,7 +335,7 @@ static int adav80x_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = adav80x->deemph; -+ ucontrol->value.integer.value[0] = adav80x->deemph; - return 0; - }; - -diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c -index 94cbe508dd37..d7184726f8a0 100644 ---- a/sound/soc/codecs/ak4641.c -+++ b/sound/soc/codecs/ak4641.c -@@ -76,7 +76,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -@@ -92,7 +92,7 @@ static int ak4641_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = ak4641->deemph; -+ ucontrol->value.integer.value[0] = ak4641->deemph; - return 0; - }; - -diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c -index ce05fd93dc74..a0ad41ac5574 100644 ---- a/sound/soc/codecs/cs4271.c -+++ b/sound/soc/codecs/cs4271.c -@@ -288,7 +288,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = cs4271->deemph; -+ ucontrol->value.integer.value[0] = cs4271->deemph; - return 0; - } - -@@ -298,7 +298,7 @@ static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); - -- cs4271->deemph = ucontrol->value.enumerated.item[0]; -+ cs4271->deemph = ucontrol->value.integer.value[0]; - return cs4271_set_deemph(codec); - } - -diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c -index 73f9c3630e2c..651e2fe2c31f 100644 ---- a/sound/soc/codecs/pcm1681.c -+++ b/sound/soc/codecs/pcm1681.c -@@ -118,7 +118,7 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = priv->deemph; -+ ucontrol->value.integer.value[0] = priv->deemph; - - return 0; - } -@@ -129,7 +129,7 @@ static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); - -- priv->deemph = ucontrol->value.enumerated.item[0]; -+ priv->deemph = ucontrol->value.integer.value[0]; - - return pcm1681_set_deemph(codec); - } -diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c -index 715589ff0eda..e93c36fd3073 100644 ---- a/sound/soc/codecs/sgtl5000.c -+++ b/sound/soc/codecs/sgtl5000.c -@@ -1198,13 +1198,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) - /* Enable VDDC charge pump */ - ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP; - } else if (vddio >= 3100 && vdda >= 3100) { -- /* -- * if vddio and vddd > 3.1v, -- * charge pump should be clean before set ana_pwr -- */ -- snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, -- SGTL5000_VDDC_CHRGPMP_POWERUP, 0); -- -+ ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP; - /* VDDC use VDDIO rail */ - lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD; - lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO << -diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c -index a895a5e4bdf2..c6c65001457d 100644 ---- a/sound/soc/codecs/tas5086.c -+++ b/sound/soc/codecs/tas5086.c -@@ -275,7 +275,7 @@ static int tas5086_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = priv->deemph; -+ ucontrol->value.integer.value[0] = priv->deemph; - - return 0; - } -@@ -286,7 +286,7 @@ static int tas5086_put_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); - -- priv->deemph = ucontrol->value.enumerated.item[0]; -+ priv->deemph = ucontrol->value.integer.value[0]; - - return tas5086_set_deemph(codec); - } -diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c -index 8ae50274ea8f..1a9f4574b65b 100644 ---- a/sound/soc/codecs/wm2000.c -+++ b/sound/soc/codecs/wm2000.c -@@ -610,7 +610,7 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); - -- ucontrol->value.enumerated.item[0] = wm2000->anc_active; -+ ucontrol->value.integer.value[0] = wm2000->anc_active; - - return 0; - } -@@ -620,7 +620,7 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); -- int anc_active = ucontrol->value.enumerated.item[0]; -+ int anc_active = ucontrol->value.integer.value[0]; - int ret; - - if (anc_active > 1) -@@ -643,7 +643,7 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); - -- ucontrol->value.enumerated.item[0] = wm2000->spk_ena; -+ ucontrol->value.integer.value[0] = wm2000->spk_ena; - - return 0; - } -@@ -653,7 +653,7 @@ static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); -- int val = ucontrol->value.enumerated.item[0]; -+ int val = ucontrol->value.integer.value[0]; - int ret; - - if (val > 1) -diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c -index 029720366ff8..e593722574de 100644 ---- a/sound/soc/codecs/wm8731.c -+++ b/sound/soc/codecs/wm8731.c -@@ -122,7 +122,7 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8731->deemph; -+ ucontrol->value.integer.value[0] = wm8731->deemph; - - return 0; - } -@@ -132,7 +132,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - int ret = 0; - - if (deemph > 1) -diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c -index eebcb1da3b7b..ae7d76efe063 100644 ---- a/sound/soc/codecs/wm8903.c -+++ b/sound/soc/codecs/wm8903.c -@@ -442,7 +442,7 @@ static int wm8903_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8903->deemph; -+ ucontrol->value.integer.value[0] = wm8903->deemph; - - return 0; - } -@@ -452,7 +452,7 @@ static int wm8903_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - int ret = 0; - - if (deemph > 1) -diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c -index 53bbfac6a83a..66cb9e95b5eb 100644 ---- a/sound/soc/codecs/wm8904.c -+++ b/sound/soc/codecs/wm8904.c -@@ -523,7 +523,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8904->deemph; -+ ucontrol->value.integer.value[0] = wm8904->deemph; - return 0; - } - -@@ -532,7 +532,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c -index 82c8ba975720..1c1fc6119758 100644 ---- a/sound/soc/codecs/wm8955.c -+++ b/sound/soc/codecs/wm8955.c -@@ -393,7 +393,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8955->deemph; -+ ucontrol->value.integer.value[0] = wm8955->deemph; - return 0; - } - -@@ -402,7 +402,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index 942ef8427347..2a0bfb848512 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -181,7 +181,7 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8960->deemph; -+ ucontrol->value.integer.value[0] = wm8960->deemph; - return 0; - } - -@@ -190,7 +190,7 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -diff --git a/sound/soc/jz4740/Makefile b/sound/soc/jz4740/Makefile -index be873c1b0c20..d32c540555c4 100644 ---- a/sound/soc/jz4740/Makefile -+++ b/sound/soc/jz4740/Makefile -@@ -1,10 +1,8 @@ - # - # Jz4740 Platform Support - # --snd-soc-jz4740-objs := jz4740-pcm.o - snd-soc-jz4740-i2s-objs := jz4740-i2s.o - --obj-$(CONFIG_SND_JZ4740_SOC) += snd-soc-jz4740.o - obj-$(CONFIG_SND_JZ4740_SOC_I2S) += snd-soc-jz4740-i2s.o - - # Jz4740 Machine Support diff --git a/patch/kernel/neo-patch-3.14.38-39 b/patch/kernel/neo-patch-3.14.38-39 deleted file mode 100644 index 181872fd9..000000000 --- a/patch/kernel/neo-patch-3.14.38-39 +++ /dev/null @@ -1,1101 +0,0 @@ -diff --git a/Makefile b/Makefile -index f09e19d2cc4f..b40845e11b84 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 14 --SUBLEVEL = 38 -+SUBLEVEL = 39 - EXTRAVERSION = - NAME = Remembering Coco - -diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c -index 7e95e1a86510..d68b410595c8 100644 ---- a/arch/arc/kernel/signal.c -+++ b/arch/arc/kernel/signal.c -@@ -67,7 +67,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, - sigset_t *set) - { - int err; -- err = __copy_to_user(&(sf->uc.uc_mcontext.regs), regs, -+ err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), regs, - sizeof(sf->uc.uc_mcontext.regs.scratch)); - err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - -@@ -83,7 +83,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) - if (!err) - set_current_blocked(&set); - -- err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs), -+ err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch), - sizeof(sf->uc.uc_mcontext.regs.scratch)); - - return err; -diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c -index c752cb43e52f..a6aa91f77654 100644 ---- a/arch/x86/kernel/reboot.c -+++ b/arch/x86/kernel/reboot.c -@@ -181,6 +181,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { - }, - }, - -+ /* ASRock */ -+ { /* Handle problems with rebooting on ASRock Q1900DC-ITX */ -+ .callback = set_pci_reboot, -+ .ident = "ASRock Q1900DC-ITX", -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"), -+ DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"), -+ }, -+ }, -+ - /* ASUS */ - { /* Handle problems with rebooting on ASUS P4S800 */ - .callback = set_bios_reboot, -diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c -index 17f9ec501972..fd8496a92b45 100644 ---- a/drivers/acpi/processor_idle.c -+++ b/drivers/acpi/processor_idle.c -@@ -962,7 +962,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) - return -EINVAL; - - drv->safe_state_index = -1; -- for (i = 0; i < CPUIDLE_STATE_MAX; i++) { -+ for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) { - drv->states[i].name[0] = '\0'; - drv->states[i].desc[0] = '\0'; - } -diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c -index 55298db36b2d..d18093681af2 100644 ---- a/drivers/block/nbd.c -+++ b/drivers/block/nbd.c -@@ -814,10 +814,6 @@ static int __init nbd_init(void) - return -EINVAL; - } - -- nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); -- if (!nbd_dev) -- return -ENOMEM; -- - part_shift = 0; - if (max_part > 0) { - part_shift = fls(max_part); -@@ -839,6 +835,10 @@ static int __init nbd_init(void) - if (nbds_max > 1UL << (MINORBITS - part_shift)) - return -EINVAL; - -+ nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); -+ if (!nbd_dev) -+ return -ENOMEM; -+ - for (i = 0; i < nbds_max; i++) { - struct gendisk *disk = alloc_disk(1 << part_shift); - if (!disk) -diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c -index a55e68f2cfc8..e3d2052e7552 100644 ---- a/drivers/cpuidle/cpuidle.c -+++ b/drivers/cpuidle/cpuidle.c -@@ -252,9 +252,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev) - if (!dev->registered) - return -EINVAL; - -- if (!dev->state_count) -- dev->state_count = drv->state_count; -- - ret = cpuidle_add_device_sysfs(dev); - if (ret) - return ret; -diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c -index e918b6d0caf7..dcaae4c8bc08 100644 ---- a/drivers/cpuidle/sysfs.c -+++ b/drivers/cpuidle/sysfs.c -@@ -398,7 +398,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) - struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device); - - /* state statistics */ -- for (i = 0; i < device->state_count; i++) { -+ for (i = 0; i < drv->state_count; i++) { - kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL); - if (!kobj) - goto error_state; -@@ -430,9 +430,10 @@ error_state: - */ - static void cpuidle_remove_state_sysfs(struct cpuidle_device *device) - { -+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device); - int i; - -- for (i = 0; i < device->state_count; i++) -+ for (i = 0; i < drv->state_count; i++) - cpuidle_free_state_kobj(device, i); - } - -diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c -index 362e7c49f2e1..12f82942e347 100644 ---- a/drivers/dma/omap-dma.c -+++ b/drivers/dma/omap-dma.c -@@ -487,6 +487,7 @@ static int omap_dma_terminate_all(struct omap_chan *c) - * c->desc is NULL and exit.) - */ - if (c->desc) { -+ omap_dma_desc_free(&c->desc->vd); - c->desc = NULL; - /* Avoid stopping the dma twice */ - if (!c->paused) -diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c -index 9ab30976287d..c43335ce8778 100644 ---- a/drivers/gpu/drm/radeon/radeon_bios.c -+++ b/drivers/gpu/drm/radeon/radeon_bios.c -@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev) - - static bool radeon_read_bios(struct radeon_device *rdev) - { -- uint8_t __iomem *bios; -+ uint8_t __iomem *bios, val1, val2; - size_t size; - - rdev->bios = NULL; -@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev) - return false; - } - -- if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { -+ val1 = readb(&bios[0]); -+ val2 = readb(&bios[1]); -+ -+ if (size == 0 || val1 != 0x55 || val2 != 0xaa) { - pci_unmap_rom(rdev->pdev, bios); - return false; - } -- rdev->bios = kmemdup(bios, size, GFP_KERNEL); -+ rdev->bios = kzalloc(size, GFP_KERNEL); - if (rdev->bios == NULL) { - pci_unmap_rom(rdev->pdev, bios); - return false; - } -+ memcpy_fromio(rdev->bios, bios, size); - pci_unmap_rom(rdev->pdev, bios); - return true; - } -diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c -index e0017c22bb9c..f53e9a803a0e 100644 ---- a/drivers/iio/imu/adis_trigger.c -+++ b/drivers/iio/imu/adis_trigger.c -@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev) - iio_trigger_set_drvdata(adis->trig, adis); - ret = iio_trigger_register(adis->trig); - -- indio_dev->trig = adis->trig; -+ indio_dev->trig = iio_trigger_get(adis->trig); - if (ret) - goto error_free_irq; - -diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c -index 429517117eff..30fce6723e61 100644 ---- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c -+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c -@@ -25,6 +25,16 @@ - #include - #include "inv_mpu_iio.h" - -+static void inv_clear_kfifo(struct inv_mpu6050_state *st) -+{ -+ unsigned long flags; -+ -+ /* take the spin lock sem to avoid interrupt kick in */ -+ spin_lock_irqsave(&st->time_stamp_lock, flags); -+ kfifo_reset(&st->timestamps); -+ spin_unlock_irqrestore(&st->time_stamp_lock, flags); -+} -+ - int inv_reset_fifo(struct iio_dev *indio_dev) - { - int result; -@@ -51,6 +61,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev) - INV_MPU6050_BIT_FIFO_RST); - if (result) - goto reset_fifo_fail; -+ -+ /* clear timestamps fifo */ -+ inv_clear_kfifo(st); -+ - /* enable interrupt */ - if (st->chip_config.accl_fifo_enable || - st->chip_config.gyro_fifo_enable) { -@@ -84,16 +98,6 @@ reset_fifo_fail: - return result; - } - --static void inv_clear_kfifo(struct inv_mpu6050_state *st) --{ -- unsigned long flags; -- -- /* take the spin lock sem to avoid interrupt kick in */ -- spin_lock_irqsave(&st->time_stamp_lock, flags); -- kfifo_reset(&st->timestamps); -- spin_unlock_irqrestore(&st->time_stamp_lock, flags); --} -- - /** - * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. - */ -@@ -185,7 +189,6 @@ end_session: - flush_fifo: - /* Flush HW and SW FIFOs. */ - inv_reset_fifo(indio_dev); -- inv_clear_kfifo(st); - mutex_unlock(&indio_dev->mlock); - iio_trigger_notify_done(indio_dev->trig); - -diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c -index a84112322071..055ebebc07dd 100644 ---- a/drivers/infiniband/core/umem.c -+++ b/drivers/infiniband/core/umem.c -@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, - if (dmasync) - dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs); - -+ /* -+ * If the combination of the addr and size requested for this memory -+ * region causes an integer overflow, return error. -+ */ -+ if ((PAGE_ALIGN(addr + size) <= size) || -+ (PAGE_ALIGN(addr + size) <= addr)) -+ return ERR_PTR(-EINVAL); -+ - if (!can_do_mlock()) - return ERR_PTR(-EPERM); - -diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c -index 08219fb3338b..7a515c867674 100644 ---- a/drivers/infiniband/core/uverbs_main.c -+++ b/drivers/infiniband/core/uverbs_main.c -@@ -476,6 +476,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file, - - entry->desc.async.element = element; - entry->desc.async.event_type = event; -+ entry->desc.async.reserved = 0; - entry->counter = counter; - - list_add_tail(&entry->list, &file->async_file->event_list); -diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c -index f2a3f48107e7..2592ab5f21b1 100644 ---- a/drivers/infiniband/hw/mlx4/mad.c -+++ b/drivers/infiniband/hw/mlx4/mad.c -@@ -64,6 +64,14 @@ enum { - #define GUID_TBL_BLK_NUM_ENTRIES 8 - #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) - -+/* Counters should be saturate once they reach their maximum value */ -+#define ASSIGN_32BIT_COUNTER(counter, value) do {\ -+ if ((value) > U32_MAX) \ -+ counter = cpu_to_be32(U32_MAX); \ -+ else \ -+ counter = cpu_to_be32(value); \ -+} while (0) -+ - struct mlx4_mad_rcv_buf { - struct ib_grh grh; - u8 payload[256]; -@@ -730,10 +738,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, - static void edit_counter(struct mlx4_counter *cnt, - struct ib_pma_portcounters *pma_cnt) - { -- pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2)); -- pma_cnt->port_rcv_data = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2)); -- pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames)); -- pma_cnt->port_rcv_packets = cpu_to_be32(be64_to_cpu(cnt->rx_frames)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data, -+ (be64_to_cpu(cnt->tx_bytes) >> 2)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data, -+ (be64_to_cpu(cnt->rx_bytes) >> 2)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets, -+ be64_to_cpu(cnt->tx_frames)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets, -+ be64_to_cpu(cnt->rx_frames)); - } - - static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, -diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h -index f723f1f2f578..ab851278d9d0 100644 ---- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h -+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h -@@ -30,7 +30,7 @@ - - /* Offset base used to differentiate between CAPTURE and OUTPUT - * while mmaping */ --#define DST_QUEUE_OFF_BASE (TASK_SIZE / 2) -+#define DST_QUEUE_OFF_BASE (1 << 30) - - #define MFC_BANK1_ALLOC_CTX 0 - #define MFC_BANK2_ALLOC_CTX 1 -diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c -index 744e43b480bc..f698e322a1cd 100644 ---- a/drivers/media/platform/sh_veu.c -+++ b/drivers/media/platform/sh_veu.c -@@ -1183,6 +1183,7 @@ static int sh_veu_probe(struct platform_device *pdev) - } - - *vdev = sh_veu_videodev; -+ vdev->v4l2_dev = &veu->v4l2_dev; - spin_lock_init(&veu->lock); - mutex_init(&veu->fop_lock); - vdev->lock = &veu->fop_lock; -diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c -index 61376abdab39..dbd8d21a8f10 100644 ---- a/drivers/net/can/flexcan.c -+++ b/drivers/net/can/flexcan.c -@@ -1196,6 +1196,7 @@ - const struct flexcan_devtype_data *devtype_data; - struct net_device *dev; - struct flexcan_priv *priv; -+ struct regulator *reg_xceiver; - struct resource *mem; - struct clk *clk_ipg = NULL, *clk_per = NULL; - void __iomem *base; -@@ -1203,6 +1204,12 @@ - u32 clock_freq = 0; - int wakeup = 1; - -+ reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); -+ if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER) -+ return -EPROBE_DEFER; -+ else if (IS_ERR(reg_xceiver)) -+ reg_xceiver = NULL; -+ - if (pdev->dev.of_node) - of_property_read_u32(pdev->dev.of_node, - "clock-frequency", &clock_freq); -@@ -1162,9 +1169,7 @@ static int flexcan_probe(struct platform_device *pdev) - priv->pdata = dev_get_platdata(&pdev->dev); - priv->devtype_data = devtype_data; - -- priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); -- if (IS_ERR(priv->reg_xceiver)) -- priv->reg_xceiver = NULL; -+ priv->reg_xceiver = reg_xceiver; - - netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT); - -diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h -index 3441f70d0ff9..6e8cdb8a0cc5 100644 ---- a/drivers/net/wireless/iwlwifi/dvm/dev.h -+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h -@@ -708,7 +708,6 @@ struct iwl_priv { - unsigned long reload_jiffies; - int reload_count; - bool ucode_loaded; -- bool init_ucode_run; /* Don't run init uCode again */ - - u8 plcp_delta_threshold; - -diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c -index cf03ef5619d9..8b2dedc30159 100644 ---- a/drivers/net/wireless/iwlwifi/dvm/ucode.c -+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c -@@ -418,9 +418,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv) - if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len) - return 0; - -- if (priv->init_ucode_run) -- return 0; -- - iwl_init_notification_wait(&priv->notif_wait, &calib_wait, - calib_complete, ARRAY_SIZE(calib_complete), - iwlagn_wait_calib, priv); -@@ -440,8 +437,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv) - */ - ret = iwl_wait_notification(&priv->notif_wait, &calib_wait, - UCODE_CALIB_TIMEOUT); -- if (!ret) -- priv->init_ucode_run = true; - - goto out; - -diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c -index 34ff7026440c..5d3b45640181 100644 ---- a/drivers/pci/pcie/aer/aerdrv_errprint.c -+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c -@@ -127,16 +127,8 @@ static const char *aer_agent_string[] = { - static void __print_tlp_header(struct pci_dev *dev, - struct aer_header_log_regs *t) - { -- unsigned char *tlp = (unsigned char *)&t; -- -- dev_err(&dev->dev, " TLP Header:" -- " %02x%02x%02x%02x %02x%02x%02x%02x" -- " %02x%02x%02x%02x %02x%02x%02x%02x\n", -- *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, -- *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), -- *(tlp + 11), *(tlp + 10), *(tlp + 9), -- *(tlp + 8), *(tlp + 15), *(tlp + 14), -- *(tlp + 13), *(tlp + 12)); -+ dev_err(&dev->dev, " TLP Header: %08x %08x %08x %08x\n", -+ t->dw0, t->dw1, t->dw2, t->dw3); - } - - static void __aer_print_error(struct pci_dev *dev, -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index 953bd0bfdf0d..19ddd43a00cf 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -5684,9 +5684,9 @@ free_port: - hba_free: - if (phba->msix_enabled) - pci_disable_msix(phba->pcidev); -- iscsi_host_remove(phba->shost); - pci_dev_put(phba->pcidev); - iscsi_host_free(phba->shost); -+ pci_set_drvdata(pcidev, NULL); - disable_pci: - pci_disable_device(pcidev); - return ret; -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c -index 64e487a8bf59..719bd8257520 100644 ---- a/drivers/scsi/scsi_lib.c -+++ b/drivers/scsi/scsi_lib.c -@@ -1258,9 +1258,11 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req) - "rejecting I/O to dead device\n"); - ret = BLKPREP_KILL; - break; -- case SDEV_QUIESCE: - case SDEV_BLOCK: - case SDEV_CREATED_BLOCK: -+ ret = BLKPREP_DEFER; -+ break; -+ case SDEV_QUIESCE: - /* - * If the devices is blocked we defer normal commands. - */ -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index e168a63e77ea..b61c555a5a8f 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -1165,7 +1165,7 @@ iscsit_handle_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, - * traditional iSCSI block I/O. - */ - if (iscsit_allocate_iovecs(cmd) < 0) { -- return iscsit_add_reject_cmd(cmd, -+ return iscsit_reject_cmd(cmd, - ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf); - } - immed_data = cmd->immediate_data; -diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c -index 850e232d086e..8ab46ad40f28 100644 ---- a/drivers/tty/n_tty.c -+++ b/drivers/tty/n_tty.c -@@ -247,8 +247,6 @@ static void n_tty_write_wakeup(struct tty_struct *tty) - - static void n_tty_check_throttle(struct tty_struct *tty) - { -- if (tty->driver->type == TTY_DRIVER_TYPE_PTY) -- return; - /* - * Check the remaining room for the input canonicalization - * mode. We don't want to throttle the driver if we're in -@@ -1512,23 +1510,6 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag) - n_tty_receive_char_flagged(tty, c, flag); - } - --/** -- * n_tty_receive_buf - data receive -- * @tty: terminal device -- * @cp: buffer -- * @fp: flag buffer -- * @count: characters -- * -- * Called by the terminal driver when a block of characters has -- * been received. This function must be called from soft contexts -- * not from interrupt context. The driver is responsible for making -- * calls one at a time and in order (or using flush_to_ldisc) -- * -- * n_tty_receive_buf()/producer path: -- * claims non-exclusive termios_rwsem -- * publishes read_head and canon_head -- */ -- - static void - n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp, - char *fp, int count) -@@ -1684,24 +1665,85 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, - } - } - -+/** -+ * n_tty_receive_buf_common - process input -+ * @tty: device to receive input -+ * @cp: input chars -+ * @fp: flags for each char (if NULL, all chars are TTY_NORMAL) -+ * @count: number of input chars in @cp -+ * -+ * Called by the terminal driver when a block of characters has -+ * been received. This function must be called from soft contexts -+ * not from interrupt context. The driver is responsible for making -+ * calls one at a time and in order (or using flush_to_ldisc) -+ * -+ * Returns the # of input chars from @cp which were processed. -+ * -+ * In canonical mode, the maximum line length is 4096 chars (including -+ * the line termination char); lines longer than 4096 chars are -+ * truncated. After 4095 chars, input data is still processed but -+ * not stored. Overflow processing ensures the tty can always -+ * receive more input until at least one line can be read. -+ * -+ * In non-canonical mode, the read buffer will only accept 4095 chars; -+ * this provides the necessary space for a newline char if the input -+ * mode is switched to canonical. -+ * -+ * Note it is possible for the read buffer to _contain_ 4096 chars -+ * in non-canonical mode: the read buffer could already contain the -+ * maximum canon line of 4096 chars when the mode is switched to -+ * non-canonical. -+ * -+ * n_tty_receive_buf()/producer path: -+ * claims non-exclusive termios_rwsem -+ * publishes commit_head or canon_head -+ */ - static int - n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, - char *fp, int count, int flow) - { - struct n_tty_data *ldata = tty->disc_data; -- int room, n, rcvd = 0; -+ int room, n, rcvd = 0, overflow; - - down_read(&tty->termios_rwsem); - - while (1) { -- room = receive_room(tty); -+ /* -+ * When PARMRK is set, each input char may take up to 3 chars -+ * in the read buf; reduce the buffer space avail by 3x -+ * -+ * If we are doing input canonicalization, and there are no -+ * pending newlines, let characters through without limit, so -+ * that erase characters will be handled. Other excess -+ * characters will be beeped. -+ * -+ * paired with store in *_copy_from_read_buf() -- guarantees -+ * the consumer has loaded the data in read_buf up to the new -+ * read_tail (so this producer will not overwrite unread data) -+ */ -+ size_t tail = ldata->read_tail; -+ -+ room = N_TTY_BUF_SIZE - (ldata->read_head - tail); -+ if (I_PARMRK(tty)) -+ room = (room + 2) / 3; -+ room--; -+ if (room <= 0) { -+ overflow = ldata->icanon && ldata->canon_head == tail; -+ if (overflow && room < 0) -+ ldata->read_head--; -+ room = overflow; -+ ldata->no_room = flow && !room; -+ } else -+ overflow = 0; -+ - n = min(count, room); -- if (!n) { -- if (flow && !room) -- ldata->no_room = 1; -+ if (!n) - break; -- } -- __receive_buf(tty, cp, fp, n); -+ -+ /* ignore parity errors if handling overflow */ -+ if (!overflow || !fp || *fp != TTY_PARITY) -+ __receive_buf(tty, cp, fp, n); -+ - cp += n; - if (fp) - fp += n; -@@ -1710,7 +1752,17 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, - } - - tty->receive_room = room; -- n_tty_check_throttle(tty); -+ -+ /* Unthrottle if handling overflow on pty */ -+ if (tty->driver->type == TTY_DRIVER_TYPE_PTY) { -+ if (overflow) { -+ tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE); -+ tty_unthrottle_safe(tty); -+ __tty_set_flow_change(tty, 0); -+ } -+ } else -+ n_tty_check_throttle(tty); -+ - up_read(&tty->termios_rwsem); - - return rcvd; -diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c -index 175f123f4f09..501c465feb59 100644 ---- a/drivers/tty/serial/fsl_lpuart.c -+++ b/drivers/tty/serial/fsl_lpuart.c -@@ -362,6 +362,9 @@ static void lpuart_setup_watermark(struct lpuart_port *sport) - writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE, - sport->port.membase + UARTPFIFO); - -+ /* explicitly clear RDRF */ -+ readb(sport->port.membase + UARTSR1); -+ - /* flush Tx and Rx FIFO */ - writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH, - sport->port.membase + UARTCFIFO); -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index 93fe089cd51a..b9e16abb0fab 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -383,6 +383,10 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, - status = PORT_PLC; - port_change_bit = "link state"; - break; -+ case USB_PORT_FEAT_C_PORT_CONFIG_ERROR: -+ status = PORT_CEC; -+ port_change_bit = "config error"; -+ break; - default: - /* Should never happen */ - return; -@@ -584,6 +588,8 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, - status |= USB_PORT_STAT_C_LINK_STATE << 16; - if ((raw_port_status & PORT_WRC)) - status |= USB_PORT_STAT_C_BH_RESET << 16; -+ if ((raw_port_status & PORT_CEC)) -+ status |= USB_PORT_STAT_C_CONFIG_ERROR << 16; - } - - if (hcd->speed != HCD_USB3) { -@@ -999,6 +1005,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, - case USB_PORT_FEAT_C_OVER_CURRENT: - case USB_PORT_FEAT_C_ENABLE: - case USB_PORT_FEAT_C_PORT_LINK_STATE: -+ case USB_PORT_FEAT_C_PORT_CONFIG_ERROR: - xhci_clear_port_change_bit(xhci, wValue, wIndex, - port_array[wIndex], temp); - break; -@@ -1063,7 +1070,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) - */ - status = bus_state->resuming_ports; - -- mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC; -+ mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; - - spin_lock_irqsave(&xhci->lock, flags); - /* For each port, did anything change? If so, set that bit in buf. */ -diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index 73c43e5e231b..eb3399f4c1ed 100644 ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -108,6 +108,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - if (pdev->vendor == PCI_VENDOR_ID_INTEL) { - xhci->quirks |= XHCI_LPM_SUPPORT; - xhci->quirks |= XHCI_INTEL_HOST; -+ xhci->quirks |= XHCI_AVOID_BEI; - } - if (pdev->vendor == PCI_VENDOR_ID_INTEL && - pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { -@@ -123,7 +124,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - * PPT chipsets. - */ - xhci->quirks |= XHCI_SPURIOUS_REBOOT; -- xhci->quirks |= XHCI_AVOID_BEI; - } - if (pdev->vendor == PCI_VENDOR_ID_INTEL && - (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI || -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 923500595357..2d858f81ab33 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -617,6 +617,7 @@ static const struct usb_device_id id_table_combined[] = { - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, -+ { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, - /* - * ELV devices: - */ -@@ -1901,8 +1902,12 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial) - { - struct usb_device *udev = serial->dev; - -- if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) || -- (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2"))) -+ if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) -+ return ftdi_jtag_probe(serial); -+ -+ if (udev->product && -+ (!strcmp(udev->product, "BeagleBone/XDS100V2") || -+ !strcmp(udev->product, "SNAP Connect E10"))) - return ftdi_jtag_probe(serial); - - return 0; -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index 56b1b55c4751..4e4f46f3c89c 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -561,6 +561,12 @@ - */ - #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ - -+/* -+ * Synapse Wireless product ids (FTDI_VID) -+ * http://www.synapse-wireless.com -+ */ -+#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */ -+ - - /********************************/ - /** third-party VID/PID combos **/ -diff --git a/fs/aio.c b/fs/aio.c -index 2f7e8c2e3e76..3241659491b1 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -719,6 +719,9 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) - err_cleanup: - aio_nr_sub(ctx->max_reqs); - err_ctx: -+ atomic_set(&ctx->dead, 1); -+ if (ctx->mmap_size) -+ vm_munmap(ctx->mmap_base, ctx->mmap_size); - aio_free_ring(ctx); - err: - mutex_unlock(&ctx->ring_lock); -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index a7f32bfdd5e7..ec8b6542c8bd 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -1235,21 +1235,13 @@ out: - } - - static int insert_orphan_item(struct btrfs_trans_handle *trans, -- struct btrfs_root *root, u64 offset) -+ struct btrfs_root *root, u64 ino) - { - int ret; -- struct btrfs_path *path; -- -- path = btrfs_alloc_path(); -- if (!path) -- return -ENOMEM; - -- ret = btrfs_find_item(root, path, BTRFS_ORPHAN_OBJECTID, -- offset, BTRFS_ORPHAN_ITEM_KEY, NULL); -- if (ret > 0) -- ret = btrfs_insert_orphan_item(trans, root, offset); -- -- btrfs_free_path(path); -+ ret = btrfs_insert_orphan_item(trans, root, ino); -+ if (ret == -EEXIST) -+ ret = 0; - - return ret; - } -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index 0218a9b23b38..40ddb6e93912 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -1821,6 +1821,7 @@ refind_writable: - cifsFileInfo_put(inv_file); - spin_lock(&cifs_file_list_lock); - ++refind; -+ inv_file = NULL; - goto refind_writable; - } - } -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index 34a17d425be6..30f3eb5bc022 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -630,7 +630,8 @@ smb2_clone_range(const unsigned int xid, - - /* No need to change MaxChunks since already set to 1 */ - chunk_sizes_updated = true; -- } -+ } else -+ goto cchunk_out; - } - - cchunk_out: -diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c -index 51632c40e896..7fe30f655aa5 100644 ---- a/fs/ocfs2/file.c -+++ b/fs/ocfs2/file.c -@@ -2391,10 +2391,14 @@ out_dio: - /* buffered aio wouldn't have proper lock coverage today */ - BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); - -+ if (unlikely(written <= 0)) -+ goto no_sync; -+ - if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || - ((file->f_flags & O_DIRECT) && !direct_io)) { -- ret = filemap_fdatawrite_range(file->f_mapping, *ppos, -- *ppos + count - 1); -+ ret = filemap_fdatawrite_range(file->f_mapping, -+ iocb->ki_pos - written, -+ iocb->ki_pos - 1); - if (ret < 0) - written = ret; - -@@ -2407,10 +2411,12 @@ out_dio: - } - - if (!ret) -- ret = filemap_fdatawait_range(file->f_mapping, *ppos, -- *ppos + count - 1); -+ ret = filemap_fdatawait_range(file->f_mapping, -+ iocb->ki_pos - written, -+ iocb->ki_pos - 1); - } - -+no_sync: - /* - * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io - * function pointer which is called when o_direct io completes so that -diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h -index bbc3a6c88fce..33fd7ff53a77 100644 ---- a/include/linux/blk_types.h -+++ b/include/linux/blk_types.h -@@ -180,7 +180,9 @@ enum rq_flag_bits { - __REQ_ELVPRIV, /* elevator private data attached */ - __REQ_FAILED, /* set if the request failed */ - __REQ_QUIET, /* don't worry about errors */ -- __REQ_PREEMPT, /* set for "ide_preempt" requests */ -+ __REQ_PREEMPT, /* set for "ide_preempt" requests and also -+ for requests for which the SCSI "quiesce" -+ state must be ignored. */ - __REQ_ALLOCED, /* request came from our alloc pool */ - __REQ_COPY_USER, /* contains copies of user pages */ - __REQ_FLUSH_SEQ, /* request for flush sequence */ -diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h -index 50fcbb0ac4e7..d1338170b6b9 100644 ---- a/include/linux/cpuidle.h -+++ b/include/linux/cpuidle.h -@@ -69,7 +69,6 @@ struct cpuidle_device { - unsigned int cpu; - - int last_residency; -- int state_count; - struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; - struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; - struct cpuidle_driver_kobj *kobj_driver; -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 9a3f3c4e1f5a..5e973efc036e 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -2980,6 +2980,8 @@ void rt_mutex_setprio(struct task_struct *p, int prio) - } else { - if (dl_prio(oldprio)) - p->dl.dl_boosted = 0; -+ if (rt_prio(oldprio)) -+ p->rt.timeout = 0; - p->sched_class = &fair_sched_class; - } - -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index f6f23833de44..c8e450132813 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -1016,6 +1016,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) - return NULL; - - arch_refresh_nodedata(nid, pgdat); -+ } else { -+ /* Reset the nr_zones and classzone_idx to 0 before reuse */ -+ pgdat->nr_zones = 0; -+ pgdat->classzone_idx = 0; - } - - /* we can use NODE_DATA(nid) from here */ -@@ -1863,15 +1867,6 @@ void try_offline_node(int nid) - if (is_vmalloc_addr(zone->wait_table)) - vfree(zone->wait_table); - } -- -- /* -- * Since there is no way to guarentee the address of pgdat/zone is not -- * on stack of any kernel threads or used by other kernel objects -- * without reference counting or other symchronizing method, do not -- * reset node_data and free pgdat here. Just reset it to 0 and reuse -- * the memory when the node is online again. -- */ -- memset(pgdat, 0, sizeof(*pgdat)); - } - EXPORT_SYMBOL(try_offline_node); - -diff --git a/mm/page-writeback.c b/mm/page-writeback.c -index 9f45f87a5859..51d8d15f48d7 100644 ---- a/mm/page-writeback.c -+++ b/mm/page-writeback.c -@@ -878,8 +878,11 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi, - * bw * elapsed + write_bandwidth * (period - elapsed) - * write_bandwidth = --------------------------------------------------- - * period -+ * -+ * @written may have decreased due to account_page_redirty(). -+ * Avoid underflowing @bw calculation. - */ -- bw = written - bdi->written_stamp; -+ bw = written - min(written, bdi->written_stamp); - bw *= HZ; - if (unlikely(elapsed > period)) { - do_div(bw, elapsed); -@@ -943,7 +946,7 @@ static void global_update_bandwidth(unsigned long thresh, - unsigned long now) - { - static DEFINE_SPINLOCK(dirty_lock); -- static unsigned long update_time; -+ static unsigned long update_time = INITIAL_JIFFIES; - - /* - * check locklessly first to optimize away locking for the most time -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index d0c310801479..96f64e59d70c 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2933,6 +2933,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) - goto fallback; - syn_data->ip_summed = CHECKSUM_PARTIAL; - memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); -+ skb_shinfo(syn_data)->gso_segs = 1; - if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space), - fo->data->msg_iov, 0, space))) { - kfree_skb(syn_data); -diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c -index 612a5ddaf93b..799bafc2af39 100644 ---- a/net/llc/sysctl_net_llc.c -+++ b/net/llc/sysctl_net_llc.c -@@ -18,28 +18,28 @@ static struct ctl_table llc2_timeout_table[] = { - { - .procname = "ack", - .data = &sysctl_llc2_ack_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_ack_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "busy", - .data = &sysctl_llc2_busy_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_busy_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "p", - .data = &sysctl_llc2_p_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_p_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "rej", - .data = &sysctl_llc2_rej_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_rej_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, -diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c -index b5cb2aa08f33..35773ad6d23d 100644 ---- a/net/rds/sysctl.c -+++ b/net/rds/sysctl.c -@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_table[] = { - { - .procname = "max_unacked_packets", - .data = &rds_sysctl_max_unacked_packets, -- .maxlen = sizeof(unsigned long), -+ .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, - { - .procname = "max_unacked_bytes", - .data = &rds_sysctl_max_unacked_bytes, -- .maxlen = sizeof(unsigned long), -+ .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, -diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c -index d60c0ee66387..6c4cbd97a673 100644 ---- a/security/selinux/selinuxfs.c -+++ b/security/selinux/selinuxfs.c -@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf, - goto out; - - /* No partial writes. */ -- length = EINVAL; -+ length = -EINVAL; - if (*ppos != 0) - goto out; - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 910f2dbe1b24..ca26373ebe70 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -271,7 +271,7 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) - { - /* We currently only handle front, HP */ - static hda_nid_t pins[] = { -- 0x0f, 0x10, 0x14, 0x15, 0 -+ 0x0f, 0x10, 0x14, 0x15, 0x17, 0 - }; - hda_nid_t *p; - for (p = pins; *p; p++) -@@ -2885,6 +2885,8 @@ static void alc283_init(struct hda_codec *codec) - - if (!hp_pin) - return; -+ -+ msleep(30); - hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); - - /* Index 0x43 Direct Drive HP AMP LPM Control 1 */ -@@ -3951,6 +3953,7 @@ enum { - ALC269_FIXUP_QUANTA_MUTE, - ALC269_FIXUP_LIFEBOOK, - ALC269_FIXUP_LIFEBOOK_EXTMIC, -+ ALC269_FIXUP_LIFEBOOK_HP_PIN, - ALC269_FIXUP_AMIC, - ALC269_FIXUP_DMIC, - ALC269VB_FIXUP_AMIC, -@@ -4085,6 +4088,13 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - }, -+ [ALC269_FIXUP_LIFEBOOK_HP_PIN] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x21, 0x0221102f }, /* HP out */ -+ { } -+ }, -+ }, - [ALC269_FIXUP_AMIC] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -@@ -4538,6 +4548,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), - SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), - SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), -+ SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), - SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), -diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c -index 5a723df670b4..a82ec53b8fb3 100644 ---- a/sound/usb/mixer_quirks.c -+++ b/sound/usb/mixer_quirks.c -@@ -178,6 +178,7 @@ static const struct rc_config { - { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ - { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ - { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ -+ { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ - { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ - }; - diff --git a/patch/kernel/old-h3-7458441.patch b/patch/kernel/old-h3-7458441.patch deleted file mode 100644 index 69585f3a4..000000000 --- a/patch/kernel/old-h3-7458441.patch +++ /dev/null @@ -1,226 +0,0 @@ -From patchwork Wed Oct 21 16:13:23 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [2/6] clk: sunxi: Add H3 clocks support -From: Jens Kuske -X-Patchwork-Id: 7458441 -Message-Id: <1445444007-4260-3-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Mike Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Wed, 21 Oct 2015 18:13:23 +0200 - -The H3 clock control unit is similar to the those of other sun8i family -members like the A23. - -It adds a new bus gates clock similar to the simple gates, but with a -different parent clock for each single gate. -Some of the gates use the new AHB2 clock as parent, whose clock source -is muxable between AHB1 and PLL6/2. The documentation isn't totally clear -about which devices belong to AHB2 now, especially USB EHIC/OHIC, so it -is mostly based on Allwinner kernel source code. - -Signed-off-by: Jens Kuske - ---- -Documentation/devicetree/bindings/clock/sunxi.txt | 2 + - drivers/clk/sunxi/Makefile | 1 + - drivers/clk/sunxi/clk-bus-gates.c | 105 ++++++++++++++++++++++ - drivers/clk/sunxi/clk-sunxi.c | 12 ++- - 4 files changed, 117 insertions(+), 3 deletions(-) - create mode 100644 drivers/clk/sunxi/clk-bus-gates.c - -diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt -index 8a47b77..d303dec 100644 ---- a/Documentation/devicetree/bindings/clock/sunxi.txt -+++ b/Documentation/devicetree/bindings/clock/sunxi.txt -@@ -28,6 +28,7 @@ Required properties: - "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20 - "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31 - "allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31 -+ "allwinner,sun8i-h3-ahb2-clk" - for the AHB2 clock on H3 - "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31 - "allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23 - "allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80 -@@ -55,6 +56,7 @@ Required properties: - "allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80 - "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31 - "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 -+ "allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3 - "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 - "allwinner,sun4i-a10-mmc-clk" - for the MMC clock - "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80 -diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile -index f5a35b8..ecaff7f 100644 ---- a/drivers/clk/sunxi/Makefile -+++ b/drivers/clk/sunxi/Makefile -@@ -5,6 +5,7 @@ - obj-y += clk-sunxi.o clk-factors.o - obj-y += clk-a10-hosc.o - obj-y += clk-a20-gmac.o -+obj-y += clk-bus-gates.o - obj-y += clk-mod0.o - obj-y += clk-simple-gates.o - obj-y += clk-sun8i-mbus.o -diff --git a/drivers/clk/sunxi/clk-bus-gates.c b/drivers/clk/sunxi/clk-bus-gates.c -new file mode 100644 -index 0000000..5bba0b9 ---- /dev/null -+++ b/drivers/clk/sunxi/clk-bus-gates.c -@@ -0,0 +1,105 @@ -+/* -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * Based on clk-simple-gates.c, which is: -+ * Copyright 2015 Maxime Ripard -+ * -+ * Maxime Ripard -+ * -+ * 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static DEFINE_SPINLOCK(gates_lock); -+ -+static void __init sunxi_bus_gates_setup(struct device_node *node, -+ const int protected[], -+ int nprotected) -+{ -+ struct clk_onecell_data *clk_data; -+ const char *clk_parent, *clk_name; -+ struct property *prop; -+ struct resource res; -+ void __iomem *clk_reg; -+ void __iomem *reg; -+ const __be32 *p; -+ int number, i = 0, j; -+ u8 clk_bit; -+ u32 index; -+ -+ reg = of_io_request_and_map(node, 0, of_node_full_name(node)); -+ if (IS_ERR(reg)) -+ return; -+ -+ clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); -+ if (!clk_data) -+ goto err_unmap; -+ -+ number = of_property_count_u32_elems(node, "clock-indices"); -+ of_property_read_u32_index(node, "clock-indices", number - 1, &number); -+ -+ clk_data->clks = kcalloc(number + 1, sizeof(struct clk *), GFP_KERNEL); -+ if (!clk_data->clks) -+ goto err_free_data; -+ -+ of_property_for_each_u32(node, "clock-indices", prop, p, index) { -+ of_property_read_string_index(node, "clock-output-names", -+ i, &clk_name); -+ -+ clk_parent = of_clk_get_parent_name(node, i); -+ -+ clk_reg = reg + 4 * (index / 32); -+ clk_bit = index % 32; -+ -+ clk_data->clks[index] = clk_register_gate(NULL, clk_name, -+ clk_parent, 0, -+ clk_reg, -+ clk_bit, -+ 0, &gates_lock); -+ i++; -+ -+ if (IS_ERR(clk_data->clks[index])) { -+ WARN_ON(true); -+ continue; -+ } -+ -+ for (j = 0; j < nprotected; j++) -+ if (protected[j] == index) -+ clk_prepare_enable(clk_data->clks[index]); -+ -+ } -+ -+ clk_data->clk_num = number + 1; -+ of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); -+ -+ return; -+ -+err_free_data: -+ kfree(clk_data); -+err_unmap: -+ iounmap(reg); -+ of_address_to_resource(node, 0, &res); -+ release_mem_region(res.start, resource_size(&res)); -+} -+ -+static void __init sunxi_bus_gates_init(struct device_node *node) -+{ -+ sunxi_bus_gates_setup(node, NULL, 0); -+} -+ -+CLK_OF_DECLARE(sun8i_h3_bus_gates, "allwinner,sun8i-h3-bus-gates-clk", -+ sunxi_bus_gates_init); -diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c -index 7c4aee0..6293c65 100644 ---- a/drivers/clk/sunxi/clk-sunxi.c -+++ b/drivers/clk/sunxi/clk-sunxi.c -@@ -769,6 +769,10 @@ static const struct mux_data sun6i_a31_ahb1_mux_data __initconst = { - .shift = 12, - }; - -+static const struct mux_data sun8i_h3_ahb2_mux_data __initconst = { -+ .shift = 0, -+}; -+ - static void __init sunxi_mux_clk_setup(struct device_node *node, - struct mux_data *data) - { -@@ -945,10 +949,11 @@ static const struct divs_data pll6_divs_data __initconst = { - - static const struct divs_data sun6i_a31_pll6_divs_data __initconst = { - .factors = &sun6i_a31_pll6_data, -- .ndivs = 2, -+ .ndivs = 3, - .div = { - { .fixed = 2 }, /* normal output */ - { .self = 1 }, /* base factor clock, 2x */ -+ { .fixed = 4 }, /* divided output, /2 */ - } - }; - -@@ -1147,6 +1151,7 @@ static const struct of_device_id clk_divs_match[] __initconst = { - static const struct of_device_id clk_mux_match[] __initconst = { - {.compatible = "allwinner,sun4i-a10-cpu-clk", .data = &sun4i_cpu_mux_data,}, - {.compatible = "allwinner,sun6i-a31-ahb1-mux-clk", .data = &sun6i_a31_ahb1_mux_data,}, -+ {.compatible = "allwinner,sun8i-h3-ahb2-clk", .data = &sun8i_h3_ahb2_mux_data,}, - {} - }; - -@@ -1229,6 +1234,7 @@ CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sun6i_init_clocks); - CLK_OF_DECLARE(sun6i_a31s_clk_init, "allwinner,sun6i-a31s", sun6i_init_clocks); - CLK_OF_DECLARE(sun8i_a23_clk_init, "allwinner,sun8i-a23", sun6i_init_clocks); - CLK_OF_DECLARE(sun8i_a33_clk_init, "allwinner,sun8i-a33", sun6i_init_clocks); -+CLK_OF_DECLARE(sun8i_h3_clk_init, "allwinner,sun8i-h3", sun6i_init_clocks); - - static void __init sun9i_init_clocks(struct device_node *node) - { diff --git a/patch/kernel/old-h3-7458451.patch b/patch/kernel/old-h3-7458451.patch deleted file mode 100644 index f7a4923f7..000000000 --- a/patch/kernel/old-h3-7458451.patch +++ /dev/null @@ -1,119 +0,0 @@ -From patchwork Wed Oct 21 16:13:22 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [1/6] clk: sunxi: Let divs clocks read the base factor clock name - from devicetree -From: Jens Kuske -X-Patchwork-Id: 7458451 -Message-Id: <1445444007-4260-2-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Mike Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Wed, 21 Oct 2015 18:13:22 +0200 - -Currently, the sunxi clock driver gets the name for the base factor clock -of divs clocks from the name field in factors_data. This prevents reusing -of the factor clock for clocks with same properties, but different name. - -This commit makes the divs setup function try to get a name from -clock-output-names in the devicetree. It also removes the name field where -possible and merges the sun4i PLL5 and PLL6 clocks. - -Signed-off-by: Jens Kuske - ---- -drivers/clk/sunxi/clk-sunxi.c | 39 ++++++++++++++++++++++++++++----------- - 1 file changed, 28 insertions(+), 11 deletions(-) - -diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c -index 9c79af0c..7c4aee0 100644 ---- a/drivers/clk/sunxi/clk-sunxi.c -+++ b/drivers/clk/sunxi/clk-sunxi.c -@@ -704,21 +704,12 @@ static const struct factors_data sun4i_pll5_data __initconst = { - .enable = 31, - .table = &sun4i_pll5_config, - .getter = sun4i_get_pll5_factors, -- .name = "pll5", --}; -- --static const struct factors_data sun4i_pll6_data __initconst = { -- .enable = 31, -- .table = &sun4i_pll5_config, -- .getter = sun4i_get_pll5_factors, -- .name = "pll6", - }; - - static const struct factors_data sun6i_a31_pll6_data __initconst = { - .enable = 31, - .table = &sun6i_a31_pll6_config, - .getter = sun6i_a31_get_pll6_factors, -- .name = "pll6x2", - }; - - static const struct factors_data sun5i_a13_ahb_data __initconst = { -@@ -902,6 +893,7 @@ struct gates_data { - - #define SUNXI_DIVS_MAX_QTY 4 - #define SUNXI_DIVISOR_WIDTH 2 -+#define SUNXI_DIVS_BASE_NAME_MAX_LEN 8 - - struct divs_data { - const struct factors_data *factors; /* data for the factor clock */ -@@ -941,7 +933,7 @@ static const struct divs_data pll5_divs_data __initconst = { - }; - - static const struct divs_data pll6_divs_data __initconst = { -- .factors = &sun4i_pll6_data, -+ .factors = &sun4i_pll5_data, - .ndivs = 4, - .div = { - { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */ -@@ -983,6 +975,8 @@ static void __init sunxi_divs_clk_setup(struct device_node *node, - struct clk_gate *gate = NULL; - struct clk_fixed_factor *fix_factor; - struct clk_divider *divider; -+ struct factors_data factors = *data->factors; -+ char base_name[SUNXI_DIVS_BASE_NAME_MAX_LEN]; - void __iomem *reg; - int ndivs = SUNXI_DIVS_MAX_QTY, i = 0; - int flags, clkflags; -@@ -991,8 +985,31 @@ static void __init sunxi_divs_clk_setup(struct device_node *node, - if (data->ndivs) - ndivs = data->ndivs; - -+ /* Try to find a name for base factor clock */ -+ for (i = 0; i < ndivs; i++) { -+ if (data->div[i].self) { -+ of_property_read_string_index(node, "clock-output-names", -+ i, &factors.name); -+ break; -+ } -+ } -+ /* If we don't have a .self clk use the first output-name up to '_' */ -+ if (factors.name == NULL) { -+ of_property_read_string_index(node, "clock-output-names", -+ 0, &clk_name); -+ -+ for (i = 0; i < SUNXI_DIVS_BASE_NAME_MAX_LEN - 1 && -+ clk_name[i] != '_' && -+ clk_name[i] != '\0'; i++) { -+ base_name[i] = clk_name[i]; -+ } -+ -+ base_name[i] = '\0'; -+ factors.name = base_name; -+ } -+ - /* Set up factor clock that we will be dividing */ -- pclk = sunxi_factors_clk_setup(node, data->factors); -+ pclk = sunxi_factors_clk_setup(node, &factors); - parent = __clk_get_name(pclk); - - reg = of_iomap(node, 0); diff --git a/patch/kernel/old-h3-7458631.patch b/patch/kernel/old-h3-7458631.patch deleted file mode 100644 index bb3f009ca..000000000 --- a/patch/kernel/old-h3-7458631.patch +++ /dev/null @@ -1,55 +0,0 @@ -From patchwork Wed Oct 21 16:20:26 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [4/6] reset: sunxi: Add compatible for Allwinner H3 bus resets -From: Jens Kuske -X-Patchwork-Id: 7458631 -Message-Id: <1445444428-4652-1-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Wed, 21 Oct 2015 18:20:26 +0200 - -Adding a new compatible allows us to define SoC specific behaviour -if necessary, for example forcing a particular device out of reset -even if no driver is actually using it. - -Signed-off-by: Jens Kuske -Acked-by: Maxime Ripard - ---- -Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt | 1 + - drivers/reset/reset-sunxi.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt b/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt -index c8f7757..e11f023 100644 ---- a/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt -+++ b/Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt -@@ -8,6 +8,7 @@ Required properties: - - compatible: Should be one of the following: - "allwinner,sun6i-a31-ahb1-reset" - "allwinner,sun6i-a31-clock-reset" -+ "allwinner,sun8i-h3-bus-reset" - - reg: should be register base and length as documented in the - datasheet - - #reset-cells: 1, see below -diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c -index 3d95c87..6f12b5c 100644 ---- a/drivers/reset/reset-sunxi.c -+++ b/drivers/reset/reset-sunxi.c -@@ -124,6 +124,7 @@ err_alloc: - */ - static const struct of_device_id sunxi_early_reset_dt_ids[] __initdata = { - { .compatible = "allwinner,sun6i-a31-ahb1-reset", }, -+ { .compatible = "allwinner,sun8i-h3-bus-reset", }, - { /* sentinel */ }, - }; - diff --git a/patch/kernel/old-h3-7458651.patch b/patch/kernel/old-h3-7458651.patch deleted file mode 100644 index 59d294fa7..000000000 --- a/patch/kernel/old-h3-7458651.patch +++ /dev/null @@ -1,534 +0,0 @@ -From patchwork Wed Oct 21 16:20:27 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI -From: Jens Kuske -X-Patchwork-Id: 7458651 -Message-Id: <1445444428-4652-2-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Wed, 21 Oct 2015 18:20:27 +0200 - -The Allwinner H3 is a home entertainment system oriented SoC with -four Cortex-A7 cores and a Mali-400MP2 GPU. - -Signed-off-by: Jens Kuske - ---- -arch/arm/boot/dts/sun8i-h3.dtsi | 499 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 499 insertions(+) - create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi - -diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi -new file mode 100644 -index 0000000..4114e17 ---- /dev/null -+++ b/arch/arm/boot/dts/sun8i-h3.dtsi -@@ -0,0 +1,499 @@ -+/* -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+#include "skeleton.dtsi" -+ -+#include -+#include -+ -+/ { -+ interrupt-parent = <&gic>; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <0>; -+ }; -+ -+ cpu@1 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <1>; -+ }; -+ -+ cpu@2 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <2>; -+ }; -+ -+ cpu@3 { -+ compatible = "arm,cortex-a7"; -+ device_type = "cpu"; -+ reg = <3>; -+ }; -+ }; -+ -+ timer { -+ compatible = "arm,armv7-timer"; -+ interrupts = , -+ , -+ , -+ ; -+ clock-frequency = <24000000>; -+ arm,cpu-registers-not-fw-configured; -+ }; -+ -+ memory { -+ reg = <0x40000000 0x80000000>; -+ }; -+ -+ clocks { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ -+ osc24M: osc24M_clk { -+ #clock-cells = <0>; -+ compatible = "fixed-clock"; -+ clock-frequency = <24000000>; -+ clock-output-names = "osc24M"; -+ }; -+ -+ osc32k: osc32k_clk { -+ #clock-cells = <0>; -+ compatible = "fixed-clock"; -+ clock-frequency = <32768>; -+ clock-output-names = "osc32k"; -+ }; -+ -+ pll1: clk@01c20000 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun8i-a23-pll1-clk"; -+ reg = <0x01c20000 0x4>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll1"; -+ }; -+ -+ /* dummy clock until actually implemented */ -+ pll5: pll5_clk { -+ #clock-cells = <0>; -+ compatible = "fixed-clock"; -+ clock-frequency = <0>; -+ clock-output-names = "pll5"; -+ }; -+ -+ pll6: clk@01c20028 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun6i-a31-pll6-clk"; -+ reg = <0x01c20028 0x4>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll6", "pll6x2", "pll6d2"; -+ }; -+ -+ pll8: clk@01c20044 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun6i-a31-pll6-clk"; -+ reg = <0x01c20044 0x4>; -+ clocks = <&osc24M>; -+ clock-output-names = "pll8", "pll8x2"; -+ }; -+ -+ cpu: cpu_clk@01c20050 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-cpu-clk"; -+ reg = <0x01c20050 0x4>; -+ clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>; -+ clock-output-names = "cpu"; -+ }; -+ -+ axi: axi_clk@01c20050 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-axi-clk"; -+ reg = <0x01c20050 0x4>; -+ clocks = <&cpu>; -+ clock-output-names = "axi"; -+ }; -+ -+ ahb1: ahb1_clk@01c20054 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun6i-a31-ahb1-clk"; -+ reg = <0x01c20054 0x4>; -+ clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>; -+ clock-output-names = "ahb1"; -+ }; -+ -+ ahb2: ahb2_clk@01c2005c { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun8i-h3-ahb2-clk"; -+ reg = <0x01c2005c 0x4>; -+ clocks = <&ahb1>, <&pll6 2>; -+ clock-output-names = "ahb2"; -+ }; -+ -+ apb1: apb1_clk@01c20054 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-apb0-clk"; -+ reg = <0x01c20054 0x4>; -+ clocks = <&ahb1>; -+ clock-output-names = "apb1"; -+ }; -+ -+ apb2: apb2_clk@01c20058 { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun4i-a10-apb1-clk"; -+ reg = <0x01c20058 0x4>; -+ clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>; -+ clock-output-names = "apb2"; -+ }; -+ -+ bus_gates: clk@01c20060 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun8i-h3-bus-gates-clk"; -+ reg = <0x01c20060 0x14>; -+ clock-indices = <5>, <6>, <8>, -+ <9>, <10>, <13>, -+ <14>, <17>, <18>, -+ <19>, <20>, -+ <21>, <23>, -+ <24>, <25>, -+ <26>, <27>, -+ <28>, <29>, -+ <30>, <31>, <32>, -+ <35>, <36>, <37>, -+ <40>, <41>, <43>, -+ <44>, <52>, <53>, -+ <54>, <64>, -+ <65>, <69>, <72>, -+ <76>, <77>, <78>, -+ <96>, <97>, <98>, -+ <112>, <113>, -+ <114>, <115>, <116>, -+ <128>, <135>; -+ clocks = <&ahb1>, <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb2>, <&ahb1>, -+ <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb2>, -+ <&ahb2>, <&ahb2>, <&ahb1>, -+ <&ahb1>, <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb1>, <&ahb1>, -+ <&ahb1>, <&ahb1>, <&ahb1>, -+ <&ahb1>, <&apb1>, -+ <&apb1>, <&apb1>, <&apb1>, -+ <&apb1>, <&apb1>, <&apb1>, -+ <&apb2>, <&apb2>, <&apb2>, -+ <&apb2>, <&apb2>, -+ <&apb2>, <&apb2>, <&apb2>, -+ <&ahb1>, <&ahb1>; -+ clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0", -+ "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand", -+ "ahb1_sdram", "ahb2_gmac", "ahb1_ts", -+ "ahb1_hstimer", "ahb1_spi0", -+ "ahb1_spi1", "ahb1_otg", -+ "ahb1_otg_ehci0", "ahb1_ehic1", -+ "ahb1_ehic2", "ahb1_ehic3", -+ "ahb1_otg_ohci0", "ahb2_ohic1", -+ "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve", -+ "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint", -+ "ahb1_csi", "ahb1_tve", "ahb1_hdmi", -+ "ahb1_de", "ahb1_gpu", "ahb1_msgbox", -+ "ahb1_spinlock", "apb1_codec", -+ "apb1_spdif", "apb1_pio", "apb1_ths", -+ "apb1_i2s0", "apb1_i2s1", "apb1_i2s2", -+ "apb2_i2c0", "apb2_i2c1", "apb2_i2c2", -+ "apb2_uart0", "apb2_uart1", -+ "apb2_uart2", "apb2_uart3", "apb2_scr", -+ "ahb1_ephy", "ahb1_dbg"; -+ }; -+ -+ mmc0_clk: clk@01c20088 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-mmc-clk"; -+ reg = <0x01c20088 0x4>; -+ clocks = <&osc24M>, <&pll6 0>, <&pll8 0>; -+ clock-output-names = "mmc0", -+ "mmc0_output", -+ "mmc0_sample"; -+ }; -+ -+ mmc1_clk: clk@01c2008c { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-mmc-clk"; -+ reg = <0x01c2008c 0x4>; -+ clocks = <&osc24M>, <&pll6 0>, <&pll8 0>; -+ clock-output-names = "mmc1", -+ "mmc1_output", -+ "mmc1_sample"; -+ }; -+ -+ mmc2_clk: clk@01c20090 { -+ #clock-cells = <1>; -+ compatible = "allwinner,sun4i-a10-mmc-clk"; -+ reg = <0x01c20090 0x4>; -+ clocks = <&osc24M>, <&pll6 0>, <&pll8 0>; -+ clock-output-names = "mmc2", -+ "mmc2_output", -+ "mmc2_sample"; -+ }; -+ -+ mbus_clk: clk@01c2015c { -+ #clock-cells = <0>; -+ compatible = "allwinner,sun8i-a23-mbus-clk"; -+ reg = <0x01c2015c 0x4>; -+ clocks = <&osc24M>, <&pll6 1>, <&pll5>; -+ clock-output-names = "mbus"; -+ }; -+ }; -+ -+ soc@01c00000 { -+ compatible = "simple-bus"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ -+ dma: dma-controller@01c02000 { -+ compatible = "allwinner,sun8i-h3-dma"; -+ reg = <0x01c02000 0x1000>; -+ interrupts = ; -+ clocks = <&bus_gates 6>; -+ resets = <&bus_rst 6>; -+ #dma-cells = <1>; -+ }; -+ -+ mmc0: mmc@01c0f000 { -+ compatible = "allwinner,sun5i-a13-mmc"; -+ reg = <0x01c0f000 0x1000>; -+ clocks = <&bus_gates 8>, -+ <&mmc0_clk 0>, -+ <&mmc0_clk 1>, -+ <&mmc0_clk 2>; -+ clock-names = "ahb", -+ "mmc", -+ "output", -+ "sample"; -+ resets = <&bus_rst 8>; -+ reset-names = "ahb"; -+ interrupts = ; -+ status = "disabled"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ mmc1: mmc@01c10000 { -+ compatible = "allwinner,sun5i-a13-mmc"; -+ reg = <0x01c10000 0x1000>; -+ clocks = <&bus_gates 9>, -+ <&mmc1_clk 0>, -+ <&mmc1_clk 1>, -+ <&mmc1_clk 2>; -+ clock-names = "ahb", -+ "mmc", -+ "output", -+ "sample"; -+ resets = <&bus_rst 9>; -+ reset-names = "ahb"; -+ interrupts = ; -+ status = "disabled"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ mmc2: mmc@01c11000 { -+ compatible = "allwinner,sun5i-a13-mmc"; -+ reg = <0x01c11000 0x1000>; -+ clocks = <&bus_gates 10>, -+ <&mmc2_clk 0>, -+ <&mmc2_clk 1>, -+ <&mmc2_clk 2>; -+ clock-names = "ahb", -+ "mmc", -+ "output", -+ "sample"; -+ resets = <&bus_rst 10>; -+ reset-names = "ahb"; -+ interrupts = ; -+ status = "disabled"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ pio: pinctrl@01c20800 { -+ compatible = "allwinner,sun8i-h3-pinctrl"; -+ reg = <0x01c20800 0x400>; -+ interrupts = , -+ ; -+ clocks = <&bus_gates 69>; -+ gpio-controller; -+ #gpio-cells = <3>; -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ -+ uart0_pins_a: uart0@0 { -+ allwinner,pins = "PA4", "PA5"; -+ allwinner,function = "uart0"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc0_pins_a: mmc0@0 { -+ allwinner,pins = "PF0", "PF1", "PF2", "PF3", -+ "PF4", "PF5"; -+ allwinner,function = "mmc0"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc0_cd_pin: mmc0_cd_pin@0 { -+ allwinner,pins = "PF6"; -+ allwinner,function = "gpio_in"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ -+ mmc1_pins_a: mmc1@0 { -+ allwinner,pins = "PG0", "PG1", "PG2", "PG3", -+ "PG4", "PG5"; -+ allwinner,function = "mmc1"; -+ allwinner,drive = ; -+ allwinner,pull = ; -+ }; -+ }; -+ -+ bus_rst: reset@01c202c0 { -+ #reset-cells = <1>; -+ compatible = "allwinner,sun8i-h3-bus-reset"; -+ reg = <0x01c202c0 0x1c>; -+ }; -+ -+ timer@01c20c00 { -+ compatible = "allwinner,sun4i-a10-timer"; -+ reg = <0x01c20c00 0xa0>; -+ interrupts = , -+ ; -+ clocks = <&osc24M>; -+ }; -+ -+ wdt0: watchdog@01c20ca0 { -+ compatible = "allwinner,sun6i-a31-wdt"; -+ reg = <0x01c20ca0 0x20>; -+ interrupts = ; -+ }; -+ -+ uart0: serial@01c28000 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28000 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 112>; -+ resets = <&bus_rst 208>; -+ dmas = <&dma 6>, <&dma 6>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ uart1: serial@01c28400 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28400 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 113>; -+ resets = <&bus_rst 209>; -+ dmas = <&dma 7>, <&dma 7>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ uart2: serial@01c28800 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28800 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 114>; -+ resets = <&bus_rst 210>; -+ dmas = <&dma 8>, <&dma 8>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ uart3: serial@01c28c00 { -+ compatible = "snps,dw-apb-uart"; -+ reg = <0x01c28c00 0x400>; -+ interrupts = ; -+ reg-shift = <2>; -+ reg-io-width = <4>; -+ clocks = <&bus_gates 115>; -+ resets = <&bus_rst 211>; -+ dmas = <&dma 9>, <&dma 9>; -+ dma-names = "rx", "tx"; -+ status = "disabled"; -+ }; -+ -+ gic: interrupt-controller@01c81000 { -+ compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic"; -+ reg = <0x01c81000 0x1000>, -+ <0x01c82000 0x1000>, -+ <0x01c84000 0x2000>, -+ <0x01c86000 0x2000>; -+ interrupt-controller; -+ #interrupt-cells = <3>; -+ interrupts = ; -+ }; -+ -+ rtc: rtc@01f00000 { -+ compatible = "allwinner,sun6i-a31-rtc"; -+ reg = <0x01f00000 0x54>; -+ interrupts = , -+ ; -+ }; -+ }; -+}; diff --git a/patch/kernel/old-h3-7458661.patch b/patch/kernel/old-h3-7458661.patch deleted file mode 100644 index 347d40452..000000000 --- a/patch/kernel/old-h3-7458661.patch +++ /dev/null @@ -1,127 +0,0 @@ -From patchwork Wed Oct 21 16:20:28 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [6/6] ARM: dts: sun8i: Add Orange Pi Plus support -From: Jens Kuske -X-Patchwork-Id: 7458661 -Message-Id: <1445444428-4652-3-git-send-email-jenskuske@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , Philipp Zabel , - =?UTF-8?q?Emilio=20L=C3=B3pez?= -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi@googlegroups.com, Jens Kuske , - linux-arm-kernel@lists.infradead.org -Date: Wed, 21 Oct 2015 18:20:28 +0200 - -The Orange Pi Plus is a SBC based on the Allwinner H3 SoC -with 8GB eMMC, multiple USB ports through a USB hub chip, SATA through -a USB-SATA bridge, one uSD slot, a 10/100/1000M ethernet port, -WiFi, HDMI, headphone jack, IR receiver, a microphone, a CSI connector -and a 40-pin GPIO header. - -Signed-off-by: Jens Kuske - ---- -arch/arm/boot/dts/Makefile | 3 +- - arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 77 ++++++++++++++++++++++++++++ - 2 files changed, 79 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts - -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 35a3cf4..bedf51b 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -643,3 +643,4 @@ dtb-$(CONFIG_MACH_SUN8I) += \ -- sun8i-a33-sinlinx-sina33.dtb -+ sun8i-a33-sinlinx-sina33.dtb \ -+ sun8i-h3-orangepi-plus.dtb - dtb-$(CONFIG_MACH_SUN9I) += \ - sun9i-a80-optimus.dtb \ - sun9i-a80-cubieboard4.dtb -diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts -new file mode 100644 -index 0000000..e67df59 ---- /dev/null -+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts -@@ -0,0 +1,77 @@ -+/* -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file 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 file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+#include "sun8i-h3.dtsi" -+#include "sunxi-common-regulators.dtsi" -+ -+#include -+#include -+ -+/ { -+ model = "Xunlong Orange Pi Plus"; -+ compatible = "xunlong,orangepi-plus", "allwinner,sun8i-h3"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; diff --git a/patch/kernel/old-h3-7458701.patch b/patch/kernel/old-h3-7458701.patch deleted file mode 100644 index dec13d98d..000000000 --- a/patch/kernel/old-h3-7458701.patch +++ /dev/null @@ -1,593 +0,0 @@ -From patchwork Wed Oct 21 16:30:46 2015 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [3/6] pinctrl: sunxi: Add H3 PIO controller support -From: Jens Kuske -X-Patchwork-Id: 7458701 -Message-Id: <5627BDB6.6020501@gmail.com> -To: Maxime Ripard , - Chen-Yu Tsai , Michael Turquette , - Linus Walleij , - Rob Herring , - Philipp Zabel , =?UTF-8?Q?Emilio_L=c3=b3pez?= - -Cc: devicetree@vger.kernel.org, Vishnu Patekar , - linux-kernel@vger.kernel.org, Hans de Goede , - linux-sunxi , - Jens Kuske , linux-arm-kernel@lists.infradead.org -Date: Wed, 21 Oct 2015 18:30:46 +0200 - -The H3 uses the same pin controller as previous SoC's from Allwinner. -Add support for the pins controlled by the main PIO controller. - -Signed-off-by: Jens Kuske -Acked-by: Maxime Ripard - ---- -.../bindings/pinctrl/allwinner,sunxi-pinctrl.txt | 1 + - drivers/pinctrl/sunxi/Kconfig | 4 + - drivers/pinctrl/sunxi/Makefile | 1 + - drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c | 516 +++++++++++++++++++++ - 4 files changed, 522 insertions(+) - create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c - -diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt -index 3c821cd..094451c 100644 ---- a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt -@@ -17,6 +17,7 @@ Required properties: - "allwinner,sun8i-a23-pinctrl" - "allwinner,sun8i-a23-r-pinctrl" - "allwinner,sun8i-a33-pinctrl" -+ "allwinner,sun8i-h3-pinctrl" - - - reg: Should contain the register physical address and length for the - pin controller. -diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig -index ae27872..f161e4c 100644 ---- a/drivers/pinctrl/sunxi/Kconfig -+++ b/drivers/pinctrl/sunxi/Kconfig -@@ -47,6 +47,10 @@ config PINCTRL_SUN8I_A23_R - depends on RESET_CONTROLLER - select PINCTRL_SUNXI_COMMON - -+config PINCTRL_SUN8I_H3 -+ def_bool MACH_SUN8I -+ select PINCTRL_SUNXI_COMMON -+ - config PINCTRL_SUN9I_A80 - def_bool MACH_SUN9I - select PINCTRL_SUNXI_COMMON -diff --git a/drivers/pinctrl/sunxi/Makefile b/drivers/pinctrl/sunxi/Makefile -index 227a121..ca19592 100644 ---- a/drivers/pinctrl/sunxi/Makefile -+++ b/drivers/pinctrl/sunxi/Makefile -@@ -12,4 +12,5 @@ obj-$(CONFIG_PINCTRL_SUN7I_A20) += pinctrl-sun7i-a20.o - obj-$(CONFIG_PINCTRL_SUN8I_A23) += pinctrl-sun8i-a23.o - obj-$(CONFIG_PINCTRL_SUN8I_A23_R) += pinctrl-sun8i-a23-r.o - obj-$(CONFIG_PINCTRL_SUN8I_A33) += pinctrl-sun8i-a33.o -+obj-$(CONFIG_PINCTRL_SUN8I_H3) += pinctrl-sun8i-h3.o - obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o -diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c -new file mode 100644 -index 0000000..98d465d ---- /dev/null -+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c -@@ -0,0 +1,516 @@ -+/* -+ * Allwinner H3 SoCs pinctrl driver. -+ * -+ * Copyright (C) 2015 Jens Kuske -+ * -+ * Based on pinctrl-sun8i-a23.c, which is: -+ * Copyright (C) 2014 Chen-Yu Tsai -+ * Copyright (C) 2014 Maxime Ripard -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "pinctrl-sunxi.h" -+ -+static const struct sunxi_desc_pin sun8i_h3_pins[] = { -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* TX */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* MS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)), /* PA_EINT0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* RX */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* CK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)), /* PA_EINT1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* RTS */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* DO */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)), /* PA_EINT2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ -+ SUNXI_FUNCTION(0x3, "jtag"), /* DI */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)), /* PA_EINT3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart0"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)), /* PA_EINT4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart0"), /* RX */ -+ SUNXI_FUNCTION(0x3, "pwm0"), -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)), /* PA_EINT5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* PWREN */ -+ SUNXI_FUNCTION(0x3, "pwm1"), -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)), /* PA_EINT6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* CLK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)), /* PA_EINT7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* DATA */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)), /* PA_EINT8 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* RST */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)), /* PA_EINT9 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "sim"), /* DET */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)), /* PA_EINT10 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2c0"), /* SCK */ -+ SUNXI_FUNCTION(0x3, "di"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)), /* PA_EINT11 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2c0"), /* SDA */ -+ SUNXI_FUNCTION(0x3, "di"), /* RX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 12)), /* PA_EINT12 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* CS */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 13)), /* PA_EINT13 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* CLK */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* RX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 14)), /* PA_EINT14 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* RTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 15)), /* PA_EINT15 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 16), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spi1"), /* MISO */ -+ SUNXI_FUNCTION(0x3, "uart3"), /* CTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 16)), /* PA_EINT16 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 17), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "spdif"), /* OUT */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 17)), /* PA_EINT17 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 18), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* SYNC */ -+ SUNXI_FUNCTION(0x3, "i2c1"), /* SCK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 18)), /* PA_EINT18 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 19), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* CLK */ -+ SUNXI_FUNCTION(0x3, "i2c1"), /* SDA */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 19)), /* PA_EINT19 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 20), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* DOUT */ -+ SUNXI_FUNCTION(0x3, "sim"), /* VPPEN */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 20)), /* PA_EINT20 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 21), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s0"), /* DIN */ -+ SUNXI_FUNCTION(0x3, "sim"), /* VPPPP */ -+ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 21)), /* PA_EINT21 */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* WE */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* ALE */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* MISO */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* CLE */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* CLK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */ -+ SUNXI_FUNCTION(0x3, "spi0")), /* CS */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0")), /* CE0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* RE */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0")), /* RB1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand"), /* DQ6 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand"), /* DQ7 */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "nand"), /* DQS */ -+ SUNXI_FUNCTION(0x3, "mmc2")), /* RST */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXD0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXCK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXCTL/RCDV */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* RXERR */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD2L */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXD0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* CRS */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXCK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXCTL/TXEN */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* TXERR */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* CLKIN/COL */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 16), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* MDC */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 17), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "emac")), /* MDIO */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* PCLK */ -+ SUNXI_FUNCTION(0x3, "ts")), /* CLK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* MCLK */ -+ SUNXI_FUNCTION(0x3, "ts")), /* ERR */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* HSYNC */ -+ SUNXI_FUNCTION(0x3, "ts")), /* SYNC */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* VSYNC */ -+ SUNXI_FUNCTION(0x3, "ts")), /* DVLD */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D0 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D1 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D2 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D3 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D4 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D5 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D6 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* D7 */ -+ SUNXI_FUNCTION(0x3, "ts")), /* D7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* SCK */ -+ SUNXI_FUNCTION(0x3, "i2c2")), /* SCK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "csi"), /* SDA */ -+ SUNXI_FUNCTION(0x3, "i2c2")), /* SDA */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 14), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out")), -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 15), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out")), -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* MS */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* DI */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */ -+ SUNXI_FUNCTION(0x3, "uart0")), /* TX */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* DO */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */ -+ SUNXI_FUNCTION(0x3, "uart0")), /* RX */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */ -+ SUNXI_FUNCTION(0x3, "jtag")), /* CK */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc0")), /* DET */ -+ /* Hole */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)), /* PG_EINT0 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 1)), /* PG_EINT1 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 2)), /* PG_EINT2 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 3)), /* PG_EINT3 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 4)), /* PG_EINT4 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 5)), /* PG_EINT5 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* TX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 6)), /* PG_EINT6 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* RX */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 7)), /* PG_EINT7 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* RTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)), /* PG_EINT8 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "uart1"), /* CTS */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)), /* PG_EINT9 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* SYNC */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 10)), /* PG_EINT10 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* CLK */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 11)), /* PG_EINT11 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* DOUT */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 12)), /* PG_EINT12 */ -+ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13), -+ SUNXI_FUNCTION(0x0, "gpio_in"), -+ SUNXI_FUNCTION(0x1, "gpio_out"), -+ SUNXI_FUNCTION(0x2, "i2s1"), /* DIN */ -+ SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 13)), /* PG_EINT13 */ -+}; -+ -+static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = { -+ .pins = sun8i_h3_pins, -+ .npins = ARRAY_SIZE(sun8i_h3_pins), -+ .irq_banks = 2, -+}; -+ -+static int sun8i_h3_pinctrl_probe(struct platform_device *pdev) -+{ -+ return sunxi_pinctrl_init(pdev, -+ &sun8i_h3_pinctrl_data); -+} -+ -+static const struct of_device_id sun8i_h3_pinctrl_match[] = { -+ { .compatible = "allwinner,sun8i-h3-pinctrl", }, -+ {} -+}; -+ -+static struct platform_driver sun8i_h3_pinctrl_driver = { -+ .probe = sun8i_h3_pinctrl_probe, -+ .driver = { -+ .name = "sun8i-h3-pinctrl", -+ .of_match_table = sun8i_h3_pinctrl_match, -+ }, -+}; -+builtin_platform_driver(sun8i_h3_pinctrl_driver); diff --git a/patch/kernel/packaging-next.patch.old b/patch/kernel/packaging-next.patch.old deleted file mode 100644 index b32606c43..000000000 --- a/patch/kernel/packaging-next.patch.old +++ /dev/null @@ -1,133 +0,0 @@ -diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst -old mode 100644 -new mode 100755 -index 909ed7a..f69e726 ---- a/scripts/Makefile.dtbinst -+++ b/scripts/Makefile.dtbinst -@@ -23,8 +23,8 @@ include $(srctree)/$(obj)/Makefile - PHONY += __dtbs_install_prep - __dtbs_install_prep: - ifeq ("$(dtbinst-root)", "$(obj)") -- $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi -- $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi -+ #$(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi -+ #$(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi - $(Q)mkdir -p $(INSTALL_DTBS_PATH) - endif - -diff --git a/scripts/package/builddeb b/scripts/package/builddeb -index 5972624..272d558 100755 ---- a/scripts/package/builddeb -+++ b/scripts/package/builddeb -@@ -80,11 +80,13 @@ - fwdir="$objtree/debian/fwtmp" - kernel_headers_dir="$objtree/debian/hdrtmp" - libc_headers_dir="$objtree/debian/headertmp" -+dtb_dir="$objtree/debian/dtbtmp" - dbg_dir="$objtree/debian/dbgtmp" --packagename=linux-image-$version --fwpackagename=linux-firmware-image-$version --kernel_headers_packagename=linux-headers-$version --libc_headers_packagename=linux-libc-dev -+packagename=linux-image-next"$LOCALVERSION" -+fwpackagename=linux-firmware-image-next"$LOCALVERSION" -+kernel_headers_packagename=linux-headers-next"$LOCALVERSION" -+dtb_packagename=linux-dtb-next"$LOCALVERSION" -+libc_headers_packagename=linux-libc-dev-next"$LOCALVERSION" - dbg_packagename=$packagename-dbg - - if [ "$ARCH" = "um" ] ; then -@@ -108,13 +110,17 @@ - BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)" - - # Setup the directory structure --rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" -+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" - mkdir -m 755 -p "$tmpdir/DEBIAN" - mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" - mkdir -m 755 -p "$fwdir/DEBIAN" - mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename" - mkdir -m 755 -p "$libc_headers_dir/DEBIAN" - mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" -+ -+mkdir -m 755 -p "$dtb_dir/DEBIAN" -+mkdir -p "$dtb_dir/boot/dtb" "$dtb_dir/usr/share/doc/$dtb_packagename" -+ - mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" - mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" - mkdir -p "$kernel_headers_dir/lib/modules/$version/" -@@ -165,6 +171,11 @@ - fi - fi - -+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then -+ #mkdir -p "$tmpdir/boot/dtb" -+ INSTALL_DTBS_PATH="$dtb_dir/boot/dtb" $MAKE KBUILD_SRC= dtbs_install -+fi -+ - if [ "$ARCH" != "um" ]; then - $MAKE headers_check KBUILD_SRC= - $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" -@@ -189,9 +200,11 @@ - set -e - - # Pass maintainer script parameters to hook scripts -+ - export DEB_MAINT_PARAMS="\$*" - - # Tell initramfs builder whether it's wanted -+ - export INITRD=$want_initrd - - test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d -@@ -200,6 +213,15 @@ - chmod 755 "$tmpdir/DEBIAN/$script" - done - -+## -+## Create sym link to kernel image -+## -+kernel_tmp_version="${installed_image_path////\\/}" -+sed -e "s/exit 0/ln -sf \/$kernel_tmp_version \/boot\/zImage || cp \/$kernel_tmp_version \/boot\/zImage/g" -i $tmpdir/DEBIAN/postinst -+echo "touch /boot/.next" >> $tmpdir/DEBIAN/postinst -+echo "exit 0" >> $tmpdir/DEBIAN/postinst -+ -+ - # Try to determine maintainer and email values - if [ -n "$DEBEMAIL" ]; then - email=$DEBEMAIL -@@ -315,7 +337,7 @@ - cat <> debian/control - - Package: $kernel_headers_packagename --Provides: linux-headers, linux-headers-2.6 -+Provides: linux-headers - Architecture: any - Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch} - This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch} -@@ -341,6 +363,16 @@ - - cat <> debian/control - -+Package: $dtb_packagename -+Architecture: any -+Description: Linux DTB, version $version -+ This package contains device blobs from the Linux kernel, version $version. -+EOF -+ -+create_package "$dtb_packagename" "$dtb_dir" -+ -+cat <> debian/control -+ - Package: $libc_headers_packagename - Section: devel - Provides: linux-kernel-headers -@@ -352,7 +384,7 @@ - - if [ "$ARCH" != "um" ]; then - create_package "$kernel_headers_packagename" "$kernel_headers_dir" -- create_package "$libc_headers_packagename" "$libc_headers_dir" -+# create_package "$libc_headers_packagename" "$libc_headers_dir" - fi - - create_package "$packagename" "$tmpdir" diff --git a/patch/kernel/spi-sun7i.patch b/patch/kernel/spi-sun7i.patch deleted file mode 100644 index 3ce979140..000000000 --- a/patch/kernel/spi-sun7i.patch +++ /dev/null @@ -1,2262 +0,0 @@ -diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig -index c4fb46a..12b2477 100644 ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -381,6 +381,15 @@ config SUN5I_SPI_NDMA - This selects SPI DMA mode with DMA transfer - Y select NDMA mode and N select DDMA mode - -+config SPI_SUN7I -+ tristate "SUN7I SPI Controller" -+ depends on ARCH_SUN7I -+ help -+ Allwinner Soc SPI controller,present on SUN7I chips. -+ Different DMA Architecture than Sun4i -+ -+ -+ - config SPI_TEGRA - tristate "Nvidia Tegra SPI controller" - depends on ARCH_TEGRA && TEGRA_SYSTEM_DMA -diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile -index a13913f..8e9bb71 100644 ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -64,4 +64,5 @@ obj-$(CONFIG_SPI_TXX9) += spi-txx9.o - obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o - obj-$(CONFIG_SPI_SUN4I) += spi_sunxi.o - obj-$(CONFIG_SPI_SUN5I) += spi_sunxi.o -+obj-$(CONFIG_SPI_SUN7I) += spi-sun7i.o - -diff --git a/drivers/spi/spi-sun7i.c b/drivers/spi/spi-sun7i.c -new file mode 100644 -index 0000000..52c9d09 ---- /dev/null -+++ b/drivers/spi/spi-sun7i.c -@@ -0,0 +1,2226 @@ -+/* -+ * drivers/spi/spi-sun7i.c -+ * Copyright (C) 2012 - 2016 Reuuimlla Limited -+ * Pan Nan -+ * James Deng -+ * -+ * SUN7I SPI Controller Driver -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define SPI_DEBUG_LEVEL 2 -+#define CONFIG_SUN7I_SPI_NDMA -+ -+#ifndef MAX_UDELAY_MS -+#define MAX_UDELAY_US 5000 -+#else -+#define MAX_UDELAY_US (MAX_UDELAY_MS*1000) -+#endif -+ -+ -+#if (SPI_DEBUG_LEVEL == 1) -+ #define spi_dbg(format,args...) do {} while (0) -+ #define spi_inf(format,args...) do {} while (0) -+ #define spi_err(format,args...) printk(KERN_ERR "[spi-err] "format,##args) -+#elif (SPI_DEBUG_LEVEL == 2) -+ #define spi_dbg(format,args...) do {} while (0) -+ #define spi_inf(format,args...) printk(KERN_INFO"[spi-inf] "format,##args) -+ #define spi_err(format,args...) printk(KERN_ERR "[spi-err] "format,##args) -+#elif (SPI_DEBUG_LEVEL == 3) -+ #define spi_dbg(format,args...) printk(KERN_INFO"[spi-dbg] "format,##args) -+ #define spi_inf(format,args...) printk(KERN_INFO"[spi-inf] "format,##args) -+ #define spi_err(format,args...) printk(KERN_ERR "[spi-err] "format,##args) -+#endif -+ -+enum spi_duplex_flag { -+ HALF_DUPLEX_RX, // half duplex read -+ HALF_DUPLEX_TX, // half duplex write -+ FULL_DUPLEX_RX_TX, // full duplex read and write -+ DUPLEX_NULL, -+}; -+ -+enum spi_dma_dir { -+ SPI_DMA_NULL = 0, -+ SPI_DMA_RDEV = 1, -+ SPI_DMA_WDEV = 2, -+}; -+ -+#define SYS_SPI_PIN -+#ifndef SYS_SPI_PIN -+static void* __iomem gpio_addr = NULL; -+ -+/* gpio base address */ -+#define _PIO_BASE_ADDRESS (0x01c20800) -+ -+/* gpio spi1 */ -+#define _Pn_CFG1(n) ( (n)*0x24 + 0x04 + gpio_addr ) -+#define _Pn_DRV1(n) ( (n)*0x24 + 0x14 + gpio_addr ) -+#define _Pn_PUL1(n) ( (n)*0x24 + 0x1C + gpio_addr ) -+#endif -+ -+struct sun7i_spi { -+ struct platform_device *pdev; -+ struct spi_master *master; /* kzalloc */ -+ void __iomem *base_addr; /* register */ -+ struct clk *hclk; /* ahb spi gating bit */ -+ struct clk *mclk; /* ahb spi gating bit */ -+ unsigned long gpio_hdle; -+ dma_chan_type_e dma_type; -+ int dma_id_tx; -+ int dma_id_rx; -+ dma_hdl_t dma_hdle_tx; -+ dma_hdl_t dma_hdle_rx; -+ enum spi_duplex_flag duplex_flag; -+ unsigned int irq; /* irq NO. */ -+ int busy; -+#define SPI_FREE (1<<0) -+#define SPI_SUSPND (1<<1) -+#define SPI_BUSY (1<<2) -+ int result; /* 0: succeed, -1: fail */ -+ struct workqueue_struct *workqueue; -+ struct work_struct work; -+ struct list_head queue; /* spi messages */ -+ spinlock_t lock; -+ struct completion done; /* wakup another spi transfer */ -+ /* keep select during one message */ -+ void (*cs_control)(struct spi_device *spi, bool on); -+ /* (1) enable cs1, cs_bitmap = SPI_CHIP_SELECT_CS1; -+ * (2) enable cs0&cs1,cs_bitmap = SPI_CHIP_SELECT_CS0|SPI_CHIP_SELECT_CS1; -+ */ -+#define SPI_CHIP_SELECT_CS0 (0x01) -+#define SPI_CHIP_SELECT_CS1 (0x02) -+ int cs_bitmap; /* cs0- 0x1, cs1-0x2, cs0 & cs1-0x3. */ -+}; -+ -+/* config chip select */ -+s32 spi_set_cs(u32 chipselect, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ -+ if (chipselect < 4) { -+ reg_val &= ~SPI_CTL_SS_MASK;/* SS-chip select, clear two bits */ -+ reg_val |= chipselect << SPI_SS_BIT_POS;/* set chip select */ -+ -+ writel(reg_val, base_addr + SPI_CTL_REG); -+ -+ return 0; -+ } else { -+ spi_err("%s: chip select set fail, cs = %d\n", __func__, chipselect); -+ return -1; -+ } -+} -+ -+/* select dma type */ -+s32 spi_sel_dma_type(u32 dma_type, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ -+ reg_val &= ~SPI_CTL_DMAMOD; -+ if (dma_type) { -+ reg_val |= 1 << 5; -+ } -+ writel(reg_val, base_addr + SPI_CTL_REG); -+ -+ return 0; -+} -+ -+/* config spi */ -+void spi_config(u32 master, u32 config, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ -+ /* 1. POL */ -+ if (config & SPI_POL_ACTIVE_) { -+ reg_val |= SPI_CTL_POL; -+ } else { -+ reg_val &= ~SPI_CTL_POL; /* default POL = 0 */ -+ } -+ -+ /*2. PHA */ -+ if (config & SPI_PHA_ACTIVE_) { -+ reg_val |= SPI_CTL_PHA; -+ } else { -+ reg_val &= ~SPI_CTL_PHA; /* default PHA = 0 */ -+ } -+ -+ /* 3. SSPOL, chip select signal polarity */ -+ if (config & SPI_CS_HIGH_ACTIVE_) { -+ reg_val &= ~SPI_CTL_SSPOL; -+ } else { -+ reg_val |= SPI_CTL_SSPOL; /* default SSPOL = 1,Low level effective */ -+ } -+ -+ /* 4. LMTF-LSB/MSB transfer first select */ -+ if (config & SPI_LSB_FIRST_ACTIVE_) { -+ reg_val |= SPI_CTL_LMTF; -+ } else { -+ reg_val &= ~SPI_CTL_LMTF; /* default LMTF = 0, MSB first */ -+ } -+ -+ /* master mode: set DDB,DHB,SMC,SSCTL */ -+ if (master == 1) { -+ /* 5. dummy burst type */ -+ if (config & SPI_DUMMY_ONE_ACTIVE_) { -+ reg_val |= SPI_CTL_DDB; -+ } else { -+ reg_val &= ~SPI_CTL_DDB; /* default DDB =0, ZERO */ -+ } -+ -+ /* 6. discard hash burst-DHB */ -+ if (config & SPI_RECEIVE_ALL_ACTIVE_) { -+ reg_val &= ~SPI_CTL_DHB; -+ } else { -+ reg_val |= SPI_CTL_DHB; /* default DHB =1, discard unused burst */ -+ } -+ -+ /* 7. set SMC = 1, SSCTL = 0, TPE = 1 */ -+ reg_val &= ~SPI_CTL_SSCTL; -+ reg_val |= SPI_CTL_T_PAUSE_EN; -+ } else { -+ /* tips for slave mode config */ -+ spi_inf("%s: slave mode configurate control register\n", __func__); -+ } -+ -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* restore reg data after transfer complete */ -+void spi_restore_state(u32 master, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ -+ /* -+ * config spi control register -+ * | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | -+ * | DHB| DDB | SS | SMC | XCH |TFRST|RFRST|SSCTL| MSB | TBW |SSPOL| POL | PHA | MOD | EN | -+ * | 1 | 0 | 00 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | -+ */ -+ /* master mode */ -+ if (master) { -+ reg_val |= (SPI_CTL_DHB | SPI_CTL_SSPOL | SPI_CTL_POL | SPI_CTL_PHA | SPI_CTL_FUNC_MODE | SPI_CTL_EN); -+ -+ /* new bit,transmit pause enable,stop smart dummy when rxfifo full */ -+ reg_val |= SPI_CTL_T_PAUSE_EN; -+ -+ /* |SPI_CTL_TBW); //deleted SPI_CTL_TBW bit for aw1623, this bit is defined for dma mode select, 2011-5-26 19:55:32 */ -+ reg_val &= ~(SPI_CTL_DDB | SPI_CTL_SS_MASK | SPI_CTL_XCH | SPI_CTL_SSCTL | SPI_CTL_LMTF); -+ } else { /* slave mode */ -+ reg_val |= (SPI_CTL_SSPOL | SPI_CTL_POL | SPI_CTL_PHA || SPI_CTL_EN); -+ -+ /* |SPI_CTL_TBW); //deleted SPI_CTL_TBW bit for aw1623, this bit is defined for dma mode select, 2011-5-26 19:55:32 */ -+ reg_val &= ~(SPI_CTL_DHB | SPI_CTL_FUNC_MODE | SPI_CTL_DDB | SPI_CTL_SS_MASK | SPI_CTL_XCH | SPI_CTL_SSCTL | SPI_CTL_LMTF); -+ } -+ -+ spi_dbg("control register set default value: 0x%08x\n", reg_val); -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* set spi clock */ -+void spi_set_clk(u32 spi_clk, u32 ahb_clk, void *base_addr) -+{ -+ u32 reg_val = 0; -+ u32 N = 0; -+ u32 div_clk = (ahb_clk >> 1) / spi_clk; -+ -+ reg_val = readl(base_addr + SPI_CLK_RATE_REG); -+ -+ if (div_clk <= SPI_CLK_SCOPE) { -+ if (div_clk != 0) { -+ div_clk--; -+ } -+ -+ reg_val &= ~SPI_CLKCTL_CDR2; -+ reg_val |= (div_clk | SPI_CLKCTL_DRS); -+ } else { -+ while (1) { -+ if (div_clk == 1) { -+ break; -+ } -+ div_clk >>= 1; -+ N++; -+ }; -+ -+ reg_val &= ~(SPI_CLKCTL_CDR1 | SPI_CLKCTL_DRS); -+ reg_val |= (N << 8); -+ } -+ -+ writel(reg_val, base_addr + SPI_CLK_RATE_REG); -+} -+ -+/* start spi transfer */ -+void spi_start_xfer(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val |= SPI_CTL_XCH; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* query tranfer is completed in smc mode */ -+u32 spi_query_xfer(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ return (reg_val & SPI_CTL_XCH); -+} -+ -+/* enable spi bus */ -+void spi_enable_bus(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val |= SPI_CTL_EN; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* disbale spi bus */ -+void spi_disable_bus(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val &= ~SPI_CTL_EN; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* set master mode */ -+void spi_set_master(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val |= SPI_CTL_FUNC_MODE; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* set slave mode */ -+void spi_set_slave(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val &= ~SPI_CTL_FUNC_MODE; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* disable irq type */ -+void spi_disable_irq(u32 bitmap, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_INT_CTL_REG); -+ bitmap &= SPI_INTEN_MASK; -+ reg_val &= ~bitmap; -+ writel(reg_val, base_addr + SPI_INT_CTL_REG); -+} -+ -+/* enable irq type */ -+void spi_enable_irq(u32 bitmap, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_INT_CTL_REG); -+ bitmap &= SPI_INTEN_MASK; -+ reg_val |= bitmap; -+ writel(reg_val, (base_addr + SPI_INT_CTL_REG)); -+} -+ -+/* disable dma irq */ -+void spi_disable_dma_irq(u32 bitmap, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_DMA_CTL_REG); -+ bitmap &= SPI_DRQEN_MASK; -+ reg_val &= ~bitmap; -+ writel(reg_val, base_addr + SPI_DMA_CTL_REG); -+} -+ -+/* enable dma irq */ -+void spi_enable_dma_irq(u32 bitmap, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_DMA_CTL_REG); -+ bitmap &= SPI_DRQEN_MASK; -+ reg_val |= bitmap; -+ writel(reg_val, base_addr + SPI_DMA_CTL_REG); -+} -+ -+/* query irq pending */ -+u32 spi_qry_irq_pending(void *base_addr) -+{ -+ return (SPI_STAT_MASK & readl(base_addr + SPI_STATUS_REG)); -+} -+ -+/* clear irq pending */ -+void spi_clr_irq_pending(u32 pending_bit, void *base_addr) -+{ -+ pending_bit &= SPI_STAT_MASK; -+ writel(pending_bit, base_addr + SPI_STATUS_REG); -+} -+ -+/* query txfifo bytes */ -+u32 spi_query_txfifo(void *base_addr) -+{ -+ u32 reg_val = (SPI_FIFO_TXCNT & readl(base_addr + SPI_FIFO_STA_REG)); -+ reg_val >>= SPI_TXCNT_BIT_POS; -+ return reg_val; -+} -+ -+/* query rxfifo bytes */ -+u32 spi_query_rxfifo(void *base_addr) -+{ -+ u32 reg_val = (SPI_FIFO_RXCNT & readl(base_addr + SPI_FIFO_STA_REG)); -+ reg_val >>= SPI_RXCNT_BIT_POS; -+ return reg_val; -+} -+ -+/* reset fifo */ -+void spi_reset_fifo(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val |= (SPI_CTL_RST_RXFIFO | SPI_CTL_RST_TXFIFO); -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* set transfer total length BC and transfer length WTC */ -+void spi_set_bc_wtc(u32 tx_len, u32 rx_len, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_BC_REG); -+ reg_val &= ~SPI_BC_BC_MASK; -+ reg_val |= (SPI_BC_BC_MASK & (tx_len + rx_len)); -+ writel(reg_val, base_addr + SPI_BC_REG); -+ spi_dbg("%s: bc: %u\n", __func__, readl(base_addr + SPI_BC_REG)); -+ -+ reg_val = readl(base_addr + SPI_TC_REG); -+ reg_val &= ~SPI_TC_WTC_MASK; -+ reg_val |= (SPI_TC_WTC_MASK & tx_len); -+ writel(reg_val, base_addr + SPI_TC_REG); -+ spi_dbg("%s: tc: %u\n", __func__, readl(base_addr + SPI_TC_REG)); -+} -+ -+/* set ss control */ -+void spi_ss_ctrl(void *base_addr, u32 on_off) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ -+ on_off &= 0x1; -+ if (on_off) { -+ reg_val |= SPI_CTL_SS_CTRL; -+ } else { -+ reg_val &= ~SPI_CTL_SS_CTRL; -+ } -+ -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* set ss level */ -+void spi_ss_level(void *base_addr, u32 hi_lo) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ -+ hi_lo &= 0x1; -+ if (hi_lo) { -+ reg_val |= SPI_CTL_SS_LEVEL; -+ } else { -+ reg_val &= ~SPI_CTL_SS_LEVEL; -+ } -+ -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* set wait clock counter */ -+void spi_set_waitclk_cnt(u32 waitclk_cnt, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_WAIT_REG); -+ reg_val &= ~SPI_WAIT_CLK_MASK; -+ waitclk_cnt &= SPI_WAIT_CLK_MASK; -+ reg_val |= waitclk_cnt; -+ writel(reg_val, base_addr + SPI_WAIT_REG); -+} -+ -+/* set sample delay in high speed mode */ -+void spi_set_sample_delay(u32 on_off, void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val &= ~SPI_CTL_MASTER_SDC; -+ reg_val |= on_off; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+/* keep unused burst */ -+void spi_clear_dhb(void *base_addr) -+{ -+ u32 reg_val = readl(base_addr + SPI_CTL_REG); -+ reg_val &= ~SPI_CTL_DHB; -+ writel(reg_val, base_addr + SPI_CTL_REG); -+} -+ -+static int sun7i_spi_get_cfg_csbitmap(int bus_num); -+ -+/* flush d-cache */ -+static void sun7i_spi_cleanflush_dcache_region(void *addr, __u32 len) -+{ -+ __cpuc_flush_dcache_area(addr, len/*len + (1 << 5) * 2 - 2*/); -+} -+ -+static char *spi_dma_rx[] = {"spi0_rx", "spi1_rx", "spi2_rx", "spi3_rx"}; -+static char *spi_dma_tx[] = {"spi0_tx", "spi1_tx", "spi2_tx", "spi3_tx"}; -+ -+static void sun7i_spi_dma_cb_rx(dma_hdl_t dma_hdl, void *parg) -+{ -+ struct sun7i_spi *aw_spi = (struct sun7i_spi *)parg; -+ unsigned long flags; -+ -+ spi_dbg("%s: spi%d dma read data callback\n", __func__, aw_spi->master->bus_num); -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ spi_disable_dma_irq(SPI_DRQEN_RR, aw_spi->base_addr); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+} -+ -+static void sun7i_spi_dma_cb_tx(dma_hdl_t dma_hdl, void *parg) -+{ -+ struct sun7i_spi *aw_spi = (struct sun7i_spi *)parg; -+ unsigned long flags; -+ -+ spi_dbg("%s: spi%d dma write data callback\n", __func__, aw_spi->master->bus_num); -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ spi_disable_dma_irq(SPI_DRQEN_TE, aw_spi->base_addr); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+} -+ -+/* request dma channel and set callback function */ -+static int sun7i_spi_prepare_dma(struct sun7i_spi *aw_spi, enum spi_dma_dir dma_dir) -+{ -+ int ret = 0; -+ int bus_num = aw_spi->master->bus_num; -+ dma_cb_t done_cb; -+ -+ spi_dbg("%s: enter\n", __func__); -+ if (SPI_DMA_RDEV == dma_dir) { -+ aw_spi->dma_hdle_rx = sw_dma_request(spi_dma_rx[bus_num], aw_spi->dma_type); -+ if (!aw_spi->dma_hdle_rx) { -+ spi_err("%s: spi%d request dma rx failed\n", __func__, bus_num); -+ return -EINVAL; -+ } -+ -+ done_cb.func = sun7i_spi_dma_cb_rx; -+ done_cb.parg = aw_spi; -+ ret = sw_dma_ctl(aw_spi->dma_hdle_rx, DMA_OP_SET_FD_CB, (void *)&done_cb); -+ } else if (SPI_DMA_WDEV == dma_dir) { -+ aw_spi->dma_hdle_tx = sw_dma_request(spi_dma_tx[bus_num], aw_spi->dma_type); -+ if (!aw_spi->dma_hdle_tx) { -+ spi_err("%s: spi%d request dma tx failed\n", __func__, bus_num); -+ return -EINVAL; -+ } -+ -+ done_cb.func = sun7i_spi_dma_cb_tx; -+ done_cb.parg = aw_spi; -+ ret = sw_dma_ctl(aw_spi->dma_hdle_tx, DMA_OP_SET_FD_CB, (void *)&done_cb); -+ } else { -+ return -1; -+ } -+ -+ return ret; -+} -+ -+static int sun7i_spi_config_dma(struct sun7i_spi *aw_spi, enum spi_dma_dir dma_dir, void *buf, unsigned int len) -+{ -+ int bus_num = aw_spi->master->bus_num; -+ unsigned char spi_rx_ndrq[] = {N_SRC_SPI0_RX, N_SRC_SPI1_RX, N_SRC_SPI2_RX, N_SRC_SPI3_RX}; -+ unsigned char spi_tx_ndrq[] = {N_DST_SPI0_TX, N_DST_SPI1_TX, N_DST_SPI2_TX, N_DST_SPI3_TX}; -+ unsigned char spi_rx_ddrq[] = {D_SRC_SPI0_RX, D_SRC_SPI1_RX, D_SRC_SPI2_RX, D_SRC_SPI3_RX}; -+ unsigned char spi_tx_ddrq[] = {D_DST_SPI0_TX, D_DST_SPI1_TX, D_DST_SPI2_TX, D_DST_SPI3_TX}; -+ unsigned long spi_phyaddr[] = {SPI0_BASE_ADDR, SPI1_BASE_ADDR, SPI2_BASE_ADDR, SPI3_BASE_ADDR}; /* physical address */ -+ dma_config_t spi_hw_conf; -+ dma_hdl_t dma_hdle; -+ u32 src_addr, dst_addr; -+ u32 security = SRC_SECU_DST_SECU; -+ -+ spi_dbg("%s: enter\n", __func__); -+ spi_hw_conf.xfer_type.src_data_width = DATA_WIDTH_8BIT; -+ spi_hw_conf.xfer_type.src_bst_len = DATA_BRST_1; -+ spi_hw_conf.xfer_type.dst_data_width = DATA_WIDTH_8BIT; -+ spi_hw_conf.xfer_type.dst_bst_len = DATA_BRST_1; -+ spi_hw_conf.bconti_mode = false; -+ spi_hw_conf.irq_spt = CHAN_IRQ_FD; -+ switch (aw_spi->dma_type) { -+ case CHAN_NORMAL: -+ if (SPI_DMA_RDEV == dma_dir) { -+ spi_hw_conf.address_type.src_addr_mode = NDMA_ADDR_NOCHANGE; -+ spi_hw_conf.address_type.dst_addr_mode = NDMA_ADDR_INCREMENT; -+ spi_hw_conf.src_drq_type = spi_rx_ndrq[bus_num]; -+ spi_hw_conf.dst_drq_type = N_DST_SDRAM; -+ } else if (SPI_DMA_WDEV == dma_dir) { -+ spi_hw_conf.address_type.src_addr_mode = NDMA_ADDR_INCREMENT; -+ spi_hw_conf.address_type.dst_addr_mode = NDMA_ADDR_NOCHANGE; -+ spi_hw_conf.src_drq_type = N_SRC_SDRAM; -+ spi_hw_conf.dst_drq_type = spi_tx_ndrq[bus_num]; -+ } else { -+ return -1; -+ } -+ break; -+ -+ case CHAN_DEDICATE: -+ if (SPI_DMA_RDEV == dma_dir) { -+ spi_hw_conf.address_type.src_addr_mode = DDMA_ADDR_IO; -+ spi_hw_conf.address_type.dst_addr_mode = DDMA_ADDR_LINEAR; -+ spi_hw_conf.src_drq_type = spi_rx_ddrq[bus_num]; -+ spi_hw_conf.dst_drq_type = D_DST_SDRAM; -+ } else if (SPI_DMA_WDEV == dma_dir) { -+ spi_hw_conf.address_type.src_addr_mode = DDMA_ADDR_LINEAR; -+ spi_hw_conf.address_type.dst_addr_mode = DDMA_ADDR_IO; -+ spi_hw_conf.src_drq_type = D_SRC_SDRAM; -+ spi_hw_conf.dst_drq_type = spi_tx_ddrq[bus_num]; -+ } else { -+ return -1; -+ } -+ break; -+ } -+ -+ if (SPI_DMA_RDEV == dma_dir) { -+ dma_hdle = aw_spi->dma_hdle_rx; -+ src_addr = spi_phyaddr[bus_num] + SPI_RXDATA_REG; -+ dst_addr = virt_to_phys(buf); -+ } else if (SPI_DMA_WDEV == dma_dir) { -+ dma_hdle = aw_spi->dma_hdle_tx; -+ src_addr = virt_to_phys(buf); -+ dst_addr = spi_phyaddr[bus_num] + SPI_TXDATA_REG; -+ } else { -+ return -1; -+ } -+ -+ /* set src, dst, drq type, configuration */ -+ if (sw_dma_config(dma_hdle, &spi_hw_conf)) { -+ spi_err("%s: spi%d config failed\n", __func__, bus_num); -+ return -1; -+ } -+ -+ if (sw_dma_ctl(dma_hdle, DMA_OP_SET_SECURITY, &security)) { -+ spi_err("%s: spi%d set dma SRC_SECU_DST_SECU failed\n", __func__, -+ bus_num); -+ return -1; -+ } -+ -+ if (CHAN_DEDICATE == aw_spi->dma_type) { -+ dma_para_t para = { -+ .src_wait_cyc = 0x07, -+ .src_blk_sz = 0x1f, -+ .dst_wait_cyc = 0x07, -+ .dst_blk_sz = 0x1f -+ }; -+ -+ if (sw_dma_ctl(dma_hdle, DMA_OP_SET_PARA_REG, ¶)) { -+ spi_err("%s: spi%d set dma para failed\n", __func__, bus_num); -+ return -1; -+ } -+ } -+ -+ /* 1. flush d-cache */ -+ sun7i_spi_cleanflush_dcache_region((void *)buf, len); -+ -+ /* 2. enqueue dma transfer */ -+ return sw_dma_enqueue(dma_hdle, src_addr, dst_addr, len); -+} -+ -+/* set dma start flag, if queue, it will auto restart to transfer next queue */ -+static int sun7i_spi_start_dma(struct sun7i_spi *aw_spi, enum spi_dma_dir dma_dir) -+{ -+ int ret = 0; -+ -+ spi_dbg("%s: enter\n", __func__); -+ if (SPI_DMA_RDEV == dma_dir) { -+ ret = sw_dma_ctl(aw_spi->dma_hdle_rx, DMA_OP_START, NULL); -+ } else if (SPI_DMA_WDEV == dma_dir) { -+ ret = sw_dma_ctl(aw_spi->dma_hdle_tx, DMA_OP_START, NULL); -+ } else { -+ return -1; -+ } -+ -+ return ret; -+} -+ -+/* release dma channel, and set queue status to idle. */ -+static int sun7i_spi_release_dma(struct sun7i_spi *aw_spi, enum spi_dma_dir dma_dir) -+{ -+ int ret = 0; -+ unsigned long flags; -+ -+ spi_dbg("%s: enter\n", __func__); -+ if (SPI_DMA_RDEV == dma_dir) { -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ ret = sw_dma_ctl(aw_spi->dma_hdle_rx, DMA_OP_STOP, NULL); -+ ret += sw_dma_release(aw_spi->dma_hdle_rx); -+ aw_spi->dma_hdle_rx = NULL; -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ } else if (SPI_DMA_WDEV == dma_dir) { -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ ret = sw_dma_ctl(aw_spi->dma_hdle_tx, DMA_OP_STOP, NULL); -+ ret += sw_dma_release(aw_spi->dma_hdle_tx); -+ aw_spi->dma_hdle_tx = NULL; -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ } else { -+ return -1; -+ } -+ -+ return ret; -+} -+ -+/* check the valid of cs id */ -+static int sun7i_spi_check_cs(int cs_id, struct sun7i_spi *aw_spi) -+{ -+ int ret = -1; -+ switch (cs_id) { -+ case 0: -+ ret = (aw_spi->cs_bitmap & SPI_CHIP_SELECT_CS0) ? 0 : -1; -+ break; -+ case 1: -+ ret = (aw_spi->cs_bitmap & SPI_CHIP_SELECT_CS1) ? 0 : -1; -+ break; -+ default: -+ spi_err("%s: spi%d chip select not support, cs = %d\n", -+ __func__, aw_spi->master->bus_num, cs_id); -+ break; -+ } -+ -+ return ret; -+} -+ -+/* spi device on or off control */ -+static void sun7i_spi_cs_control(struct spi_device *spi, bool on) -+{ -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(spi->master); -+ unsigned int cs = 0; -+ if (aw_spi->cs_control) { -+ if (on) { -+ /* set active */ -+ cs = (spi->mode & SPI_CS_HIGH) ? 1 : 0; -+ } else { -+ /* set inactive */ -+ cs = (spi->mode & SPI_CS_HIGH) ? 0 : 1; -+ } -+ spi_ss_level(aw_spi->base_addr, cs); -+ } -+} -+ -+/* -+ * change the properties of spi device with spi transfer. -+ * every spi transfer must call this interface to update the master to the excute transfer -+ * set clock frequecy, bits per word, mode etc... -+ * return: >= 0 : succeed; < 0: failed. -+ */ -+static int sun7i_spi_xfer_setup(struct spi_device *spi, struct spi_transfer *t) -+{ -+ /* get at the setup function, the properties of spi device */ -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(spi->master); -+ struct sun7i_spi_config *config = spi->controller_data; // allocate in the setup, and free in the cleanup -+ void *__iomem base_addr = aw_spi->base_addr; -+ -+ spi_dbg("%s: enter\n", __func__); -+ config->max_speed_hz = (t && t->speed_hz) ? t->speed_hz : spi->max_speed_hz; -+ config->bits_per_word = (t && t->bits_per_word) ? t->bits_per_word : spi->bits_per_word; -+ config->bits_per_word = ((config->bits_per_word + 7) / 8) * 8; -+ -+ if (config->bits_per_word != 8) { -+ spi_err("%s: spi%d just support 8bits per word\n", __func__, spi->master->bus_num); -+ return -EINVAL; -+ } -+ -+ if (spi->chip_select >= spi->master->num_chipselect) { -+ spi_err("%s: spi%d device's chip select = %d exceeds the master supported cs_num[%d] \n", -+ __func__, spi->master->bus_num, spi->chip_select, spi->master->num_chipselect); -+ return -EINVAL; -+ } -+ -+ /* check again board info */ -+ if (sun7i_spi_check_cs(spi->chip_select, aw_spi)) { -+ spi_err("%s: sun7i_spi_check_cs failed, spi_device cs =%d\n", __func__, spi->chip_select); -+ return -EINVAL; -+ } -+ -+ /* set cs */ -+ spi_set_cs(spi->chip_select, base_addr); -+ /* -+ * master: set spi module clock; -+ * set the default frequency 10MHz -+ */ -+ spi_set_master(base_addr); -+ if (config->max_speed_hz > SPI_MAX_FREQUENCY) { -+ return -EINVAL; -+ } -+ -+#ifndef CONFIG_AW_FPGA_PLATFORM -+ spi_set_clk(config->max_speed_hz, clk_get_rate(aw_spi->mclk), base_addr); -+#else -+ spi_set_clk(config->max_speed_hz, 24000000, base_addr); -+#endif -+ -+ /* -+ * master : set POL,PHA,SSOPL,LMTF,DDB,DHB; default: SSCTL=0,SMC=1,TBW=0. -+ * set bit width-default: 8 bits -+ */ -+ spi_config(1, spi->mode, base_addr); -+ -+ return 0; -+} -+ -+/* -+ * <= 64 : cpu ; > 64 : dma -+ * wait for done completion in this function, wakup in the irq hanlder -+ */ -+static int sun7i_spi_xfer(struct spi_device *spi, struct spi_transfer *t) -+{ -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(spi->master); -+ void __iomem *base_addr = aw_spi->base_addr; -+ unsigned long flags = 0; -+ unsigned tx_len = t->len; -+ unsigned rx_len = t->len; -+ unsigned char *rx_buf = (unsigned char *)t->rx_buf; -+ unsigned char *tx_buf = (unsigned char *)t->tx_buf; -+ enum spi_dma_dir dma_dir = SPI_DMA_NULL; -+ int ret = 0; -+ -+#if (SPI_DEBUG_LEVEL== 3) -+ if(tx_len > 2) -+ spi_inf("%s: spi%d txbuf %p, start: %2x rxbuf %p, len %d\n", -+ __func__, spi->master->bus_num, tx_buf, tx_buf[0], rx_buf, tx_len); -+ else -+ spi_inf("%s: spi%d begin transfer, txbuf %p, start: %4x rxbuf %p, len %d\n", -+ __func__, spi->master->bus_num, tx_buf, tx_buf[0]<<8 | tx_buf[1], rx_buf, tx_len); -+#endif -+ -+ -+ if ((!t->tx_buf && !t->rx_buf) || !t->len) { -+ spi_err("%s: spi%d invalid buffer or len\n", __func__, spi->master->bus_num); -+ return -EINVAL; -+ } -+ /* write 1 to clear 0 */ -+ spi_clr_irq_pending(SPI_STAT_MASK, base_addr); -+ /* disable all DRQ */ -+ spi_disable_dma_irq(SPI_DRQEN_MASK, base_addr); -+ /* reset tx/rx fifo */ -+ spi_reset_fifo(base_addr); -+ -+ if (aw_spi->duplex_flag != DUPLEX_NULL) { -+ spi_err("%s: spi%d duplex flag not null\n", __func__, spi->master->bus_num); -+ return -EINVAL; -+ } -+ -+ /* set the Burst Counter and Write Transmit Counter, auto put dummy data into the txFIFO! */ -+ /* check if use full duplex or half duplex */ -+ if (tx_buf && rx_buf) { -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ aw_spi->duplex_flag = FULL_DUPLEX_RX_TX; -+ spi_set_bc_wtc(tx_len, 0, base_addr); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ } else { -+ if (tx_buf) { -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ aw_spi->duplex_flag = HALF_DUPLEX_TX; -+ spi_set_bc_wtc(tx_len, 0, base_addr); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ } else if (rx_buf) { -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ aw_spi->duplex_flag = HALF_DUPLEX_RX; -+ spi_set_bc_wtc(0, rx_len, base_addr); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ } -+ } -+ -+ /* -+ * 1. Tx/Rx error irq, process in IRQ; -+ * 2. Transfer Complete Interrupt Enable -+ */ -+ spi_enable_irq(SPI_INTEN_TC | SPI_INTEN_ERR, base_addr); -+ -+ /* > 64 use DMA transfer, or use cpu */ -+ if (t->len > BULK_DATA_BOUNDARY) { -+ spi_sel_dma_type(aw_spi->dma_type, base_addr); -+ -+ switch (aw_spi->duplex_flag) { -+ case HALF_DUPLEX_RX: { -+ spi_enable_dma_irq(SPI_DRQEN_RR, base_addr); -+ -+ dma_dir |= SPI_DMA_RDEV; -+ ret = sun7i_spi_prepare_dma(aw_spi, SPI_DMA_RDEV); -+ if (ret < 0) { -+ spi_disable_dma_irq(SPI_DRQEN_RR, base_addr); -+ spi_disable_irq(SPI_INTEN_TC | SPI_INTEN_ERR, base_addr); -+ return -EINVAL; -+ } -+ -+ sun7i_spi_config_dma(aw_spi, SPI_DMA_RDEV, (void *)rx_buf, rx_len); -+ sun7i_spi_start_dma(aw_spi, SPI_DMA_RDEV); -+ -+ spi_start_xfer(base_addr); -+ break; -+ } -+ -+ case HALF_DUPLEX_TX: { -+ spi_start_xfer(base_addr); -+ spi_enable_dma_irq(SPI_DRQEN_TE, base_addr); -+ -+ dma_dir |= SPI_DMA_WDEV; -+ ret = sun7i_spi_prepare_dma(aw_spi, SPI_DMA_WDEV); -+ if (ret < 0) { -+ spi_disable_irq(SPI_INTEN_TC | SPI_INTEN_ERR, base_addr); -+ spi_disable_dma_irq(SPI_DRQEN_TE, base_addr); -+ return -EINVAL; -+ } -+ -+ sun7i_spi_config_dma(aw_spi, SPI_DMA_WDEV, (void *)tx_buf, tx_len); -+ sun7i_spi_start_dma(aw_spi, SPI_DMA_WDEV); -+ break; -+ } -+ -+ case FULL_DUPLEX_RX_TX: { -+ spi_enable_dma_irq(SPI_DRQEN_RR, base_addr); -+ -+ dma_dir |= SPI_DMA_RDEV; -+ ret = sun7i_spi_prepare_dma(aw_spi, SPI_DMA_RDEV); -+ if (ret < 0) { -+ spi_disable_dma_irq(SPI_DRQEN_RR, base_addr); -+ spi_disable_irq(SPI_INTEN_TC | SPI_INTEN_ERR, base_addr); -+ return -EINVAL; -+ } -+ -+ sun7i_spi_config_dma(aw_spi, SPI_DMA_RDEV, (void *)rx_buf, rx_len); -+ sun7i_spi_start_dma(aw_spi, SPI_DMA_RDEV); -+ -+ spi_start_xfer(base_addr); -+ spi_enable_dma_irq(SPI_DRQEN_TE, base_addr); -+ -+ dma_dir |= SPI_DMA_WDEV; -+ ret = sun7i_spi_prepare_dma(aw_spi, SPI_DMA_WDEV); -+ if (ret < 0) { -+ spi_disable_irq(SPI_INTEN_TC | SPI_INTEN_ERR, base_addr); -+ spi_disable_dma_irq(SPI_DRQEN_TE, base_addr); -+ return -EINVAL; -+ } -+ -+ sun7i_spi_config_dma(aw_spi, SPI_DMA_WDEV, (void *)tx_buf, tx_len); -+ sun7i_spi_start_dma(aw_spi, SPI_DMA_WDEV); -+ break; -+ } -+ -+ default: -+ return -1; -+ } -+ } else { -+ switch (aw_spi->duplex_flag) { -+ case HALF_DUPLEX_RX: { -+ unsigned int poll_time = 0x7ffff; -+ /* SMC=1,XCH trigger the transfer */ -+ spi_start_xfer(base_addr); -+ while (rx_len && (--poll_time > 0)) { -+ /* rxFIFO counter */ -+ if (spi_query_rxfifo(base_addr)) { -+ *rx_buf++ = readb(base_addr + SPI_RXDATA_REG); -+ --rx_len; -+ } -+ } -+ if (poll_time <= 0) { -+ spi_err("%s: spi%d cpu receive data time out\n", -+ __func__, spi->master->bus_num); -+ } -+ break; -+ } -+ case HALF_DUPLEX_TX: { -+ unsigned int poll_time = 0xfffff; -+ spi_start_xfer(base_addr); -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ for (; tx_len > 0; --tx_len) { -+ writeb(*tx_buf++, base_addr + SPI_TXDATA_REG); -+ } -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ -+ while (spi_query_txfifo(base_addr) && (--poll_time > 0)); /* txFIFO counter */ -+ if (poll_time <= 0) { -+ spi_err("%s: spi%d cpu transfer data time out\n", -+ __func__, spi->master->bus_num); -+ } -+ break; -+ } -+ case FULL_DUPLEX_RX_TX: { -+ unsigned int poll_time_tx = 0xfffff; -+ unsigned int poll_time_rx = 0x7ffff; -+ -+ if ((rx_len == 0) || (tx_len == 0)) -+ return -EINVAL; -+ -+ spi_start_xfer(base_addr); -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ for (; tx_len > 0; --tx_len) { -+ writeb(*tx_buf++, base_addr + SPI_TXDATA_REG); -+ } -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ -+ while (spi_query_txfifo(base_addr) && (--poll_time_tx > 0)); /* txFIFO counter */ -+ if (poll_time_tx <= 0) { -+ spi_err("%s: spi%d cpu transfer data time out\n", -+ __func__, spi->master->bus_num); -+ break; -+ } -+ -+ while (rx_len && (--poll_time_rx > 0)) { -+ /* rxFIFO counter */ -+ if (spi_query_rxfifo(base_addr)) { -+ *rx_buf++ = readb(base_addr + SPI_RXDATA_REG); -+ --rx_len; -+ } -+ } -+ if (poll_time_rx <= 0) { -+ spi_err("%s: spi%d cpu receive data time out\n", -+ __func__, spi->master->bus_num); -+ } -+ break; -+ } -+ default: -+ return -1; -+ } -+ } -+ -+ /* wait for xfer complete in the isr. */ -+ spi_dbg("%s: spi%d wait for xfer complete\n", __func__, spi->master->bus_num); -+ wait_for_completion(&aw_spi->done); -+ /* get the isr return code */ -+ if (aw_spi->result != 0) { -+ spi_err("%s: spi%d xfer failed\n", __func__, spi->master->bus_num); -+ ret = -1; -+ } -+ -+ /* release dma resource if neccessary */ -+ if (SPI_DMA_RDEV & dma_dir) { -+ sun7i_spi_release_dma(aw_spi, SPI_DMA_RDEV); -+ } -+ if (SPI_DMA_WDEV & dma_dir) { -+ sun7i_spi_release_dma(aw_spi, SPI_DMA_WDEV); -+ } -+ -+ if (aw_spi->duplex_flag != DUPLEX_NULL) { -+ aw_spi->duplex_flag = DUPLEX_NULL; -+ } -+ -+ return ret; -+} -+ -+ -+/* helper for long interbyte usecs */ -+static void sun7i_spi_safe_udelay(unsigned long usecs) -+{ -+ while (usecs > MAX_UDELAY_US) { -+ udelay(MAX_UDELAY_US); -+ usecs -= MAX_UDELAY_US; -+ } -+ udelay(usecs); -+} -+ -+#include -+ -+/* spi core xfer process */ -+static void sun7i_spi_work(struct work_struct *work) -+{ -+ struct sun7i_spi *aw_spi = container_of(work, struct sun7i_spi, work); -+ unsigned long flags = 0; -+ -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ aw_spi->busy = SPI_BUSY; -+ /* -+ * get from messages queue, and then do with them, -+ * if message queue is empty ,then return and set status to free, -+ * otherwise process them. -+ */ -+ while (!list_empty(&aw_spi->queue)) { -+ struct spi_message *msg = NULL; -+ struct spi_device *spi = NULL; -+ struct spi_transfer *t = NULL; -+ struct timespec t_bef,t_now; -+ unsigned int cs_change = 0; -+ unsigned int previous_delay = 0; -+ int status; -+ /* get message from message queue in sun7i_spi. */ -+ msg = container_of(aw_spi->queue.next, struct spi_message, queue); -+ /* then delete from the message queue,now it is alone.*/ -+ -+ -+ list_del_init(&msg->queue); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ /* get spi device from this message */ -+ spi = msg->spi; -+ /* set default value,no need to change cs,keep select until spi transfer require to change cs. */ -+ cs_change = 1; -+ /* set message status to succeed. */ -+ status = -1; -+ -+ getnstimeofday(&t_bef); -+ /* search the spi transfer in this message, deal with it alone. */ -+ list_for_each_entry(t, &msg->transfers, transfer_list) { -+ if ((status == -1) || (t->bits_per_word != spi->bits_per_word) || (t->speed_hz != spi->max_speed_hz)) { /* if spi transfer is zero,use spi device value. */ -+ status = sun7i_spi_xfer_setup(spi, t); /* set the value every spi transfer */ -+ if (status < 0) -+ break; /* fail, quit */ -+ spi_dbg("[spi-%d]: xfer setup \n", aw_spi->master->bus_num); -+ } -+ -+ /* first active the cs */ -+ if (cs_change) { -+ aw_spi->cs_control(spi, 1); -+ spi_dbg("[spi-%d]: cs active",aw_spi->master->bus_num); -+ } -+ /* update the new cs value */ -+ cs_change = t->cs_change; -+ -+ /* full duplex mode */ -+ if (t->rx_buf && t->tx_buf) -+ spi_clear_dhb(aw_spi->base_addr); -+ -+ /* -+ * do transfer -+ * > 64 : dma ; <= 64 : cpu -+ * wait for done completion in this function, wakup in the irq hanlder -+ */ -+ if(previous_delay) { -+// int tx_val; -+ long passed_nsec, delay_usec; -+ getnstimeofday(&t_now); -+ passed_nsec=((t_now.tv_sec > t_bef.tv_sec) ? t_now.tv_nsec + NSEC_PER_SEC : t_now.tv_nsec) - t_bef.tv_nsec; -+ delay_usec=(long) previous_delay - (passed_nsec) / 1000L - 5L; -+ if(delay_usec<0) -+ delay_usec=0; -+// spi_inf("[spi-%d]: before transfer of %04x would still delay %5ldus\n", -+// aw_spi->master->bus_num, tx_val, delay_usec); -+ sun7i_spi_safe_udelay(delay_usec); -+ } -+ if (t->interbyte_usecs) { -+ getnstimeofday(&t_bef); -+ previous_delay=t->interbyte_usecs; -+ } -+ -+ status = sun7i_spi_xfer(spi, t); -+ if (status) -+ break; /* fail quit, zero means succeed */ -+ /* accmulate the value in the message */ -+ msg->actual_length += t->len; -+ /* may be need to delay */ -+ // getnstimeofday(&taft); -+ // spi_inf("[spi-%d]: usec before delay and since last delay: %6ld", aw_spi->master->bus_num, (taft.tv_nsec-tbef.tv_nsec)/1000L); -+ if (t->delay_usecs) { -+ udelay(t->delay_usecs); -+ } -+ // getnstimeofday(&tbef); -+ /* if zero, keep active, otherwise deactived. */ -+ if (cs_change) { -+ aw_spi->cs_control(spi, 0); -+ spi_dbg("[spi-%d]: cs inactive",aw_spi->master->bus_num); -+ } -+ -+ } -+ -+ /* -+ * spi message complete,succeed or failed -+ * return value -+ */ -+ msg->status = status; -+ /* wakup the uplayer caller,complete one message */ -+ msg->complete(msg->context); -+ /* fail or need to change cs */ -+ if (status || !cs_change) { -+ aw_spi->cs_control(spi, 0); -+ spi_dbg("[spi-%d]: cs inactive",aw_spi->master->bus_num); -+ } -+ -+ /* restore default value. */ -+ //sun7i_spi_xfer_setup(spi, NULL); -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ } -+ -+ /* set spi to free */ -+ aw_spi->busy = SPI_FREE; -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+} -+ -+/* wake up the sleep thread, and give the result code */ -+static irqreturn_t sun7i_spi_handler(int irq, void *dev_id) -+{ -+ struct sun7i_spi *aw_spi = (struct sun7i_spi *)dev_id; -+ void *base_addr = aw_spi->base_addr; -+ -+ unsigned int status = spi_qry_irq_pending(base_addr); -+ spi_clr_irq_pending(status, base_addr); -+ -+ aw_spi->result = 0; /* assume succeed */ -+ /* master mode, Transfer Complete Interrupt */ -+ if (status & SPI_STAT_TC) { -+ spi_dbg("%s: spi%d TC comes, irq status = 0x%08x\n", -+ __func__, aw_spi->master->bus_num, status); -+ spi_disable_irq(SPI_STAT_TC | SPI_STAT_ERR, base_addr); -+ /* -+ * just check dma+callback receive, skip other condition. -+ * dma+callback receive: when TC comes, dma may be still not complete fetch data from rxFIFO. -+ * other receive: cpu or dma+poll, just skip this. -+ */ -+ if (aw_spi->dma_hdle_rx) { -+ unsigned int poll_time = 0xffff; -+ /* during poll, dma maybe complete rx, rx_dma_used is 0. then return.*/ -+ while (spi_query_rxfifo(base_addr) && (--poll_time > 0)); -+ if (poll_time <= 0) { -+ spi_err("%s: spi%d dma callback method, rx data time out in irq\n", -+ __func__, aw_spi->master->bus_num); -+ aw_spi->result = -1; -+ complete(&aw_spi->done); -+ return -1; -+ } else if (poll_time < 0xffff) { -+ spi_dbg("%s: spi%d rx irq comes first, dma last. wait = 0x%x\n", -+ __func__, aw_spi->master->bus_num, poll_time); -+ } -+ } -+ -+ /* wakup uplayer, by the sem */ -+ complete(&aw_spi->done); -+ return IRQ_HANDLED; -+ } -+ /* master mode: err */ -+ else if (status & SPI_STAT_ERR) { -+ spi_err("%s: spi%d ERR comes, irq status = 0x%08x\n", -+ __func__, aw_spi->master->bus_num, status); -+ /* error process, release dma in the workqueue,should not be here */ -+ spi_disable_irq(SPI_STAT_TC | SPI_STAT_ERR, base_addr); -+ spi_restore_state(1, base_addr); -+ aw_spi->result = -1; -+ complete(&aw_spi->done); -+ spi_err("%s: spi%d master mode error: txFIFO overflow/rxFIFO underrun or overflow\n", -+ __func__, aw_spi->master->bus_num); -+ return IRQ_HANDLED; -+ } -+ -+ spi_dbg("%s: spi%d NONE comes\n", __func__, aw_spi->master->bus_num); -+ return IRQ_NONE; -+} -+ -+/* interface 1 */ -+static int sun7i_spi_transfer(struct spi_device *spi, struct spi_message *msg) -+{ -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(spi->master); -+ unsigned long flags; -+ msg->actual_length = 0; -+ msg->status = -EINPROGRESS; -+ -+ spi_dbg("%s: enter, spi_msg tx:%d, spi_msg rx:%d\n", __func__, aw_spi->dma_id_tx, aw_spi->dma_id_rx); -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ /* add msg to the sun7i_spi queue */ -+ list_add_tail(&msg->queue, &aw_spi->queue); -+ /* add work to the workqueue,schedule the cpu. */ -+ queue_work(aw_spi->workqueue, &aw_spi->work); -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ /* return immediately and wait for completion in the uplayer caller. */ -+ return 0; -+} -+ -+/* interface 2, setup the frequency and default status */ -+static int sun7i_spi_setup(struct spi_device *spi) -+{ -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(spi->master); -+ struct sun7i_spi_config *config = spi->controller_data; /* general is null. */ -+ unsigned long flags; -+ -+ spi_inf("%s: enter, bpw: %d, mshz: %d, mode: %d\n", __func__, spi->bits_per_word, spi->max_speed_hz, spi->mode); -+ /* just support 8 bits per word */ -+ if (spi->bits_per_word != 8) -+ return -EINVAL; -+ /* first check its valid,then set it as default select,finally set its */ -+ if (sun7i_spi_check_cs(spi->chip_select, aw_spi)) { -+ spi_err("%s: spi%d not support cs-%d \n", __func__, -+ spi->master->bus_num, spi->chip_select); -+ return -EINVAL; -+ } -+ -+ if (spi->max_speed_hz > SPI_MAX_FREQUENCY) -+ return -EINVAL; -+ -+ if (!config) { -+ config = kzalloc(sizeof * config, GFP_KERNEL); -+ if (!config) { -+ spi_err("%s: spi%d alloc memory for config failed\n", -+ __func__, spi->master->bus_num); -+ return -ENOMEM; -+ } -+ spi->controller_data = config; -+ } -+ -+ /* -+ * set the default vaule with spi device -+ * can change by every spi transfer -+ */ -+ config->bits_per_word = spi->bits_per_word; -+ config->max_speed_hz = spi->max_speed_hz; -+ config->mode = spi->mode; -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ /* if aw16xx spi is free, then deactived the spi device */ -+ if (aw_spi->busy & SPI_FREE) { -+ /* set chip select number */ -+ spi_set_cs(spi->chip_select, aw_spi->base_addr); -+ /* deactivate chip select */ -+ aw_spi->cs_control(spi, 0); -+ } -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ -+ return 0; -+} -+ -+/* interface 3 */ -+static void sun7i_spi_cleanup(struct spi_device *spi) -+{ -+ if (spi->controller_data) { -+ kfree(spi->controller_data); -+ spi->controller_data = NULL; -+ } -+} -+ -+static int sun7i_spi_set_gpio(struct sun7i_spi *aw_spi, bool on) -+{ -+ if(on) { -+ if(aw_spi->master->bus_num == 0) { -+ aw_spi->gpio_hdle = gpio_request_ex("spi0_para", NULL); -+ if(!aw_spi->gpio_hdle) { -+ spi_err("spi0 request gpio fail!\n"); -+ return -1; -+ } -+ //hex_dump("gpio regs:", (void __iomem*)SW_VA_PORTC_IO_BASE, 0x200, 2); -+ } -+ else if(aw_spi->master->bus_num == 1) { -+ /** -+ * PI8 SPI1_CS0 -+ * PI9 SPI1_CS1 -+ * PI10 SPI1_CLK -+ * PI11 SPI1_MOSI -+ * PI12 SPI1_MISO -+ */ -+ #ifndef SYS_SPI_PIN -+ unsigned int reg_val = readl(_Pn_CFG1(8)); -+ /* set spi function */ -+ reg_val &= ~0x77777; -+ reg_val |= 0x22222; -+ writel(reg_val, _Pn_CFG1(8)); -+ /* set pull up */ -+ reg_val = readl(_Pn_PUL1(8)); -+ reg_val &= ~(0x3ff<<16); -+ reg_val |= (0x155<<16); -+ writel(reg_val, _Pn_PUL1(8)); -+ /* no need to set driver,default is driver 1. */ -+ #else -+ aw_spi->gpio_hdle = gpio_request_ex("spi1_para", NULL); -+ if(!aw_spi->gpio_hdle) { -+ spi_err("spi1 request gpio fail!\n"); -+ return -1; -+ } -+ #endif -+ } -+ else if(aw_spi->master->bus_num == 2) { -+ aw_spi->gpio_hdle = gpio_request_ex("spi2_para", NULL); -+ if(!aw_spi->gpio_hdle) { -+ spi_err("spi2 request gpio fail!\n"); -+ return -1; -+ } -+ } -+ -+ #ifdef AW1623_FPGA -+ { -+ #include -+ void __iomem* pi_cfg0 = (void __iomem*)(SW_VA_PORTC_IO_BASE+0x48); -+ u32 rval = readl(pi_cfg0) & (~(0x70777)); -+ writel(rval|(0x30333), pi_cfg0); -+ } -+ #endif -+ } -+ else { -+ if(aw_spi->master->bus_num == 0) { -+ gpio_release(aw_spi->gpio_hdle, 0); -+ } -+ else if(aw_spi->master->bus_num == 1) { -+ #ifndef SYS_SPI_PIN -+ unsigned int reg_val = readl(_Pn_CFG1(8)); -+ /* set default */ -+ reg_val &= ~0x77777; -+ writel(reg_val, _Pn_CFG1(8)); -+ #else -+ gpio_release(aw_spi->gpio_hdle, 0); -+ #endif -+ } -+ else if(aw_spi->master->bus_num == 2) { -+ gpio_release(aw_spi->gpio_hdle, 0); -+ } -+ } -+ return 0; -+} -+ -+static int sun7i_spi_set_mclk(struct sun7i_spi *aw_spi, u32 mod_clk) -+{ -+ struct clk *source_clock = NULL; -+ char *name = NULL; -+#ifdef CONFIG_AW_FPGA_PLATFORM -+// u32 source = 0; -+#elif defined CONFIG_AW_ASIC_PLATFORM -+// u32 source = 2; -+#endif -+ u32 source = 1; -+ int ret = 0; -+ -+ switch (source) { -+ case 0: -+ source_clock = clk_get(NULL, "hosc"); -+ name = "hosc"; -+ break; -+ case 1: -+ source_clock = clk_get(NULL, "sdram_pll_p"); -+ name = "sdram_pll_p"; -+ break; -+ case 2: -+ source_clock = clk_get(NULL, "sata_pll"); -+ name = "sata_pll"; -+ break; -+ default: -+ return -1; -+ } -+ -+ if (IS_ERR(source_clock)) { -+ ret = PTR_ERR(source_clock); -+ spi_err("%s: Unable to get spi%d source clock resource\n", -+ __func__, aw_spi->master->bus_num); -+ return -1; -+ } -+ -+ if (clk_set_parent(aw_spi->mclk, source_clock)) { -+ spi_err("%s: spi%d clk_set_parent failed\n", __func__, -+ aw_spi->master->bus_num); -+ ret = -1; -+ goto out; -+ } -+ -+ if (clk_set_rate(aw_spi->mclk, mod_clk)) { -+ spi_err("%s: spi%d clk_set_rate failed\n", __func__, -+ aw_spi->master->bus_num); -+ ret = -1; -+ goto out; -+ } -+ -+ spi_inf("%s: spi%d source = %s, src_clk = %u, mclk %u\n", -+ __func__, aw_spi->master->bus_num, name, -+ (unsigned)clk_get_rate(source_clock), (unsigned)clk_get_rate(aw_spi->mclk)); -+ -+ if (clk_enable(aw_spi->mclk)) { -+ spi_err("%s: spi%d couldn't enable module clock 'spi'\n", -+ __func__, aw_spi->master->bus_num); -+ ret = -EBUSY; -+ goto out; -+ } -+ -+ ret = 0; -+out: -+ clk_put(source_clock); -+ return ret; -+} -+ -+static int sun7i_spi_hw_init(struct sun7i_spi *aw_spi) -+{ -+ void *base_addr = aw_spi->base_addr; -+ unsigned long sclk_freq = 0; -+ char *mclk_name[] = {"spi0", "spi1", "spi2", "spi3"}; -+ -+ aw_spi->mclk = clk_get(&aw_spi->pdev->dev, mclk_name[aw_spi->pdev->id]); -+ if (IS_ERR(aw_spi->mclk)) { -+ spi_err("%s: spi%d unable to acquire module clock 'spi'\n", -+ __func__, aw_spi->master->bus_num); -+ return -1; -+ } -+ if (sun7i_spi_set_mclk(aw_spi, 100000000)) { -+ spi_err("%s: spi%d sun7i_spi_set_mclk 'spi'\n", -+ __func__, aw_spi->master->bus_num); -+ clk_put(aw_spi->mclk); -+ return -1; -+ } -+ -+ /* 1. enable the spi module */ -+ spi_enable_bus(base_addr); -+ -+ /* 2. set the default chip select */ -+ if (sun7i_spi_check_cs(0, aw_spi)) { -+ spi_set_cs(1, base_addr); -+ } else { -+ spi_set_cs(0, base_addr); -+ } -+ -+ /* -+ * 3. master: set spi module clock; -+ * 4. set the default frequency 10MHz -+ */ -+ spi_set_master(base_addr); -+ sclk_freq = clk_get_rate(aw_spi->mclk); -+ spi_set_clk(10000000, sclk_freq, base_addr); -+ -+ /* -+ * 5. master : set POL,PHA,SSOPL,LMTF,DDB,DHB; default: SSCTL=0,SMC=1,TBW=0. -+ * 6. set bit width-default: 8 bits -+ */ -+ spi_config(1, SPI_MODE_0, base_addr); -+ -+ /* 7. manual control the chip select */ -+ spi_ss_ctrl(base_addr, 1); -+ return 0; -+} -+ -+static int sun7i_spi_hw_exit(struct sun7i_spi *aw_spi) -+{ -+ /* disable the spi controller */ -+ spi_disable_bus(aw_spi->base_addr); -+ /* disable module clock */ -+ clk_disable(aw_spi->mclk); -+ clk_put(aw_spi->mclk); -+ -+ return 0; -+} -+ -+static int __devinit sun7i_spi_probe(struct platform_device *pdev) -+{ -+ struct resource *mem_res, *dma_res_rx, *dma_res_tx; -+ struct sun7i_spi *aw_spi; -+ struct sun7i_spi_platform_data *pdata; -+ struct spi_master *master; -+ int ret = 0, err = 0, irq; -+ int cs_bitmap = 0; -+ -+ spi_inf("%s: sun7i spi probe", __func__); -+ -+ if (pdev->id < 0) { -+ spi_err("%s: invalid platform device id: %d\n", __func__, pdev->id); -+ return -ENODEV; -+ } -+ -+ if (pdev->dev.platform_data == NULL) { -+ spi_err("%s: platform_data missing\n", __func__); -+ return -ENODEV; -+ } -+ -+ pdata = pdev->dev.platform_data; -+ if (!pdata->clk_name) { -+ spi_err("%s: platform data must initialize\n", __func__); -+ return -EINVAL; -+ } -+ -+ /* Check for availability of necessary resource */ -+ dma_res_rx = platform_get_resource(pdev, IORESOURCE_DMA, 0); -+ if (dma_res_rx == NULL) { -+ spi_err("%s: Unable to get spi DMA RX resource\n", __func__); -+ return -ENXIO; -+ } -+ -+ dma_res_tx = platform_get_resource(pdev, IORESOURCE_DMA, 1); -+ if (dma_res_tx == NULL) { -+ spi_err("%s: Unable to get spi DMA TX resource\n", __func__); -+ return -ENXIO; -+ } -+ -+ mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (mem_res == NULL) { -+ spi_err("%s: Unable to get spi MEM resource\n", __func__); -+ return -ENXIO; -+ } -+ -+ irq = platform_get_irq(pdev, 0); -+ if (irq < 0) { -+ spi_err("%s: NO SPI IRQ specified\n", __func__); -+ return -ENXIO; -+ } -+ -+ /* create spi master */ -+ master = spi_alloc_master(&pdev->dev, sizeof(struct sun7i_spi)); -+ if (master == NULL) { -+ spi_err("%s: Unable to allocate SPI Master\n", __func__); -+ return -ENOMEM; -+ } -+ -+ platform_set_drvdata(pdev, master); -+ aw_spi = spi_master_get_devdata(master); -+ memset(aw_spi, 0, sizeof(struct sun7i_spi)); -+ -+ aw_spi->master = master; -+ aw_spi->irq = irq; -+#ifdef CONFIG_SUN7I_SPI_NDMA -+ aw_spi->dma_type = CHAN_NORMAL; -+#else -+ aw_spi->dma_type = CHAN_DEDICATE; -+#endif -+ spi_inf("%s: spi%d dma type: %s\n", __func__, pdev->id, -+ aw_spi->dma_type == CHAN_NORMAL ? "normal" : "dedicate"); -+ aw_spi->dma_id_tx = dma_res_tx->start; -+ aw_spi->dma_id_rx = dma_res_rx->start; -+ aw_spi->dma_hdle_rx = 0; -+ aw_spi->dma_hdle_tx = 0; -+ aw_spi->cs_control = sun7i_spi_cs_control; -+ aw_spi->cs_bitmap = pdata->cs_bitmap; /* cs0-0x1; cs1-0x2; cs0&cs1-0x3. */ -+ aw_spi->busy = SPI_FREE; -+ aw_spi->duplex_flag = DUPLEX_NULL; -+ -+ master->bus_num = pdev->id; -+ master->setup = sun7i_spi_setup; -+ master->cleanup = sun7i_spi_cleanup; -+ master->transfer = sun7i_spi_transfer; -+ master->num_chipselect = pdata->num_cs; -+ /* the spi->mode bits understood by this driver: */ -+ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST; -+ -+ /* update the cs bitmap */ -+ cs_bitmap = sun7i_spi_get_cfg_csbitmap(pdev->id); -+ if (cs_bitmap & 0x3) { -+ aw_spi->cs_bitmap = cs_bitmap & 0x3; -+ spi_inf("%s: spi%d cs bitmap: 0x%x\n", -+ __func__, master->bus_num, cs_bitmap); -+ } -+ -+ err = request_irq(aw_spi->irq, sun7i_spi_handler, IRQF_DISABLED, pdev->name, aw_spi); -+ if (err) { -+ spi_err("%s: Cannot claim IRQ\n", __func__); -+ goto err0; -+ } -+ -+ if (request_mem_region(mem_res->start, -+ resource_size(mem_res), pdev->name) == NULL) { -+ spi_err("%s: Req mem region failed\n", __func__); -+ ret = -ENXIO; -+ goto err1; -+ } -+ -+ aw_spi->base_addr = ioremap(mem_res->start, resource_size(mem_res)); -+ if (aw_spi->base_addr == NULL) { -+ spi_err("%s: Unable to remap IO\n", __func__); -+ ret = -ENXIO; -+ goto err2; -+ } -+ -+ /* Setup clocks */ -+ aw_spi->hclk = clk_get(&pdev->dev, pdata->clk_name); -+ if (IS_ERR(aw_spi->hclk)) { -+ spi_err("%s: Unable to get clock 'spi'\n", __func__); -+ ret = PTR_ERR(aw_spi->hclk); -+ goto err3; -+ } -+ -+ if (clk_enable(aw_spi->hclk)) { -+ spi_err("%s: Couldn't enable clock 'spi'\n", __func__); -+ ret = -EBUSY; -+ goto err4; -+ } -+ -+ aw_spi->workqueue = create_singlethread_workqueue(dev_name(master->dev.parent)); -+ if (aw_spi->workqueue == NULL) { -+ spi_err("%s: Unable to create workqueue\n", __func__); -+ ret = -ENOMEM; -+ goto err5; -+ } -+ -+ aw_spi->pdev = pdev; -+ -+ /* Setup Deufult Mode */ -+ sun7i_spi_hw_init(aw_spi); -+ -+#ifndef SYS_SPI_PIN -+ /* set gpio */ -+ gpio_addr = ioremap(_PIO_BASE_ADDRESS, 0x1000); -+#endif -+ sun7i_spi_set_gpio(aw_spi, 1); -+ -+ spin_lock_init(&aw_spi->lock); -+ init_completion(&aw_spi->done); -+ INIT_WORK(&aw_spi->work, sun7i_spi_work); /* banding the process handler */ -+ INIT_LIST_HEAD(&aw_spi->queue); -+ -+ if (spi_register_master(master)) { -+ spi_err("%s: Cannot register SPI master\n", __func__); -+ ret = -EBUSY; -+ goto err6; -+ } -+ -+ spi_inf("%s: reuuimlla's SoC SPI Driver loaded for Bus SPI%d with %d Slaves at most\n", -+ __func__, pdev->id, master->num_chipselect); -+ spi_inf("%s: spi%d driver probe succeed, base %p, irq %d, dma_id_rx %d, dma_id_tx %d\n", -+ __func__, master->bus_num, aw_spi->base_addr, aw_spi->irq, -+ aw_spi->dma_id_rx, aw_spi->dma_id_tx); -+ return 0; -+ -+err6: -+ destroy_workqueue(aw_spi->workqueue); -+err5: -+ iounmap((void *)aw_spi->base_addr); -+err4: -+err3: -+err2: -+ release_mem_region(mem_res->start, resource_size(mem_res)); -+err1: -+ free_irq(aw_spi->irq, aw_spi); -+err0: -+ platform_set_drvdata(pdev, NULL); -+ spi_master_put(master); -+ return ret; -+} -+ -+static int sun7i_spi_remove(struct platform_device *pdev) -+{ -+ struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(master); -+ struct resource *mem_res; -+ unsigned long flags; -+ -+ spi_dbg("%s: sun7i spi removal", __func__); -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ aw_spi->busy |= SPI_FREE; -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ -+ while (aw_spi->busy & SPI_BUSY) { -+ spi_inf("%s: spi%d busy\n", __func__, master->bus_num); -+ msleep(10); -+ } -+ -+ sun7i_spi_hw_exit(aw_spi); -+ spi_unregister_master(master); -+ destroy_workqueue(aw_spi->workqueue); -+ -+ clk_disable(aw_spi->hclk); -+ clk_put(aw_spi->hclk); -+ -+ iounmap((void *) aw_spi->base_addr); -+ mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (mem_res != NULL) -+ release_mem_region(mem_res->start, resource_size(mem_res)); -+ free_irq(aw_spi->irq, aw_spi); -+ platform_set_drvdata(pdev, NULL); -+ spi_master_put(master); -+ spi_inf("%s: sun7i spi removed", __func__); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_PM -+static int sun7i_spi_suspend(struct platform_device *pdev, pm_message_t state) -+{ -+ struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(master); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ aw_spi->busy |= SPI_SUSPND; -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ -+ while (aw_spi->busy & SPI_BUSY) { -+ spi_inf("%s: spi%d busy\n", __func__, master->bus_num); -+ msleep(10); -+ } -+ -+ /* Disable the clock */ -+ clk_disable(aw_spi->hclk); -+ -+ spi_inf("%s: spi%d suspend okay...\n", __func__, master->bus_num); -+ return 0; -+} -+ -+static int sun7i_spi_resume(struct platform_device *pdev) -+{ -+ struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); -+ struct sun7i_spi *aw_spi = spi_master_get_devdata(master); -+ unsigned long flags; -+ -+ /* Enable the clock */ -+ clk_enable(aw_spi->hclk); -+ sun7i_spi_hw_init(aw_spi); -+ -+ spin_lock_irqsave(&aw_spi->lock, flags); -+ -+ aw_spi->busy = SPI_FREE; -+ spin_unlock_irqrestore(&aw_spi->lock, flags); -+ -+ spi_inf("%s: spi%d resume okay...\n", __func__, master->bus_num); -+ return 0; -+} -+#else -+#define sun7i_spi_suspend NULL -+#define sun7i_spi_resume NULL -+#endif /* CONFIG_PM */ -+ -+static struct platform_driver sun7i_spi_driver = { -+ .probe = sun7i_spi_probe, -+ .remove = sun7i_spi_remove, -+ .suspend = sun7i_spi_suspend, -+ .resume = sun7i_spi_resume, -+ .driver = { -+ .name = "sun7i-spi", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+/* spi resouce and platform data start */ -+struct sun7i_spi_platform_data sun7i_spi0_pdata = { -+ .cs_bitmap = 0x3, -+ .num_cs = 2, -+ .clk_name = "ahb_spi0", -+}; -+ -+static struct resource sun7i_spi0_resources[] = { -+ [0] = { -+ .start = SPI0_BASE_ADDR, -+ .end = SPI0_BASE_ADDR + 1024, -+ .flags = IORESOURCE_MEM, -+ }, -+#ifdef CONFIG_SUN7I_SPI_NDMA -+ [1] = { -+ .start = N_SRC_SPI0_RX, -+ .end = N_SRC_SPI0_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI0_TX, -+ .end = N_DST_SPI0_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#else -+ [1] = { -+ .start = D_SRC_SPI0_RX, -+ .end = D_SRC_SPI0_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = D_DST_SPI0_TX, -+ .end = D_DST_SPI0_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#endif -+ [3] = { -+ .start = SW_INT_IRQNO_SPI00, -+ .end = SW_INT_IRQNO_SPI00, -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+static struct platform_device sun7i_spi0_device = { -+ .name = "sun7i-spi", -+ .id = 0, -+ .num_resources = ARRAY_SIZE(sun7i_spi0_resources), -+ .resource = sun7i_spi0_resources, -+ .dev = { -+ .platform_data = &sun7i_spi0_pdata, -+ }, -+}; -+ -+struct sun7i_spi_platform_data sun7i_spi1_pdata = { -+ .cs_bitmap = 0x3, -+ .num_cs = 2, -+ .clk_name = "ahb_spi1", -+}; -+ -+static struct resource sun7i_spi1_resources[] = { -+ [0] = { -+ .start = SPI1_BASE_ADDR, -+ .end = SPI1_BASE_ADDR + 1024, -+ .flags = IORESOURCE_MEM, -+ }, -+#ifdef CONFIG_SUN7I_SPI_NDMA -+ [1] = { -+ .start = N_SRC_SPI1_RX, -+ .end = N_SRC_SPI1_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI1_TX, -+ .end = N_DST_SPI1_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#else -+ [1] = { -+ .start = D_SRC_SPI1_RX, -+ .end = D_SRC_SPI1_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI1_TX, -+ .end = N_DST_SPI1_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#endif -+ [3] = { -+ .start = SW_INT_IRQNO_SPI01, -+ .end = SW_INT_IRQNO_SPI01, -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+static struct platform_device sun7i_spi1_device = { -+ .name = "sun7i-spi", -+ .id = 1, -+ .num_resources = ARRAY_SIZE(sun7i_spi1_resources), -+ .resource = sun7i_spi1_resources, -+ .dev = { -+ .platform_data = &sun7i_spi1_pdata, -+ }, -+}; -+ -+static struct resource sun7i_spi2_resources[] = { -+ [0] = { -+ .start = SPI2_BASE_ADDR, -+ .end = SPI2_BASE_ADDR + 1024, -+ .flags = IORESOURCE_MEM, -+ }, -+#ifdef CONFIG_SUN7I_SPI_NDMA -+ [1] = { -+ .start = N_SRC_SPI2_RX, -+ .end = N_SRC_SPI2_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI2_TX, -+ .end = N_DST_SPI2_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#else -+ [1] = { -+ .start = D_SRC_SPI2_RX, -+ .end = D_SRC_SPI2_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI2_TX, -+ .end = N_DST_SPI2_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#endif -+ [3] = { -+ .start = SW_INT_IRQNO_SPI02, -+ .end = SW_INT_IRQNO_SPI02, -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+struct sun7i_spi_platform_data sun7i_spi2_pdata = { -+ .cs_bitmap = 0x3, -+ .num_cs = 2, -+ .clk_name = "ahb_spi2", -+}; -+ -+static struct platform_device sun7i_spi2_device = { -+ .name = "sun7i-spi", -+ .id = 2, -+ .num_resources = ARRAY_SIZE(sun7i_spi2_resources), -+ .resource = sun7i_spi2_resources, -+ .dev = { -+ .platform_data = &sun7i_spi2_pdata, -+ }, -+}; -+ -+static struct resource sun7i_spi3_resources[] = { -+ [0] = { -+ .start = SPI3_BASE_ADDR, -+ .end = SPI3_BASE_ADDR + 1024, -+ .flags = IORESOURCE_MEM, -+ }, -+#ifdef CONFIG_SUN7I_SPI_NDMA -+ [1] = { -+ .start = N_SRC_SPI3_RX, -+ .end = N_SRC_SPI3_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI3_TX, -+ .end = N_DST_SPI3_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#else -+ [1] = { -+ .start = D_SRC_SPI3_RX, -+ .end = D_SRC_SPI3_RX, -+ .flags = IORESOURCE_DMA, -+ }, -+ [2] = { -+ .start = N_DST_SPI3_TX, -+ .end = N_DST_SPI3_TX, -+ .flags = IORESOURCE_DMA, -+ }, -+#endif -+ [3] = { -+ .start = SW_INT_IRQNO_SPI3, -+ .end = SW_INT_IRQNO_SPI3, -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+struct sun7i_spi_platform_data sun7i_spi3_pdata = { -+ .cs_bitmap = 0x3, -+ .num_cs = 2, -+ .clk_name = "ahb_spi3", -+}; -+ -+static struct platform_device sun7i_spi3_device = { -+ .name = "sun7i-spi", -+ .id = 3, -+ .num_resources = ARRAY_SIZE(sun7i_spi3_resources), -+ .resource = sun7i_spi3_resources, -+ .dev = { -+ .platform_data = &sun7i_spi3_pdata, -+ }, -+}; -+ -+static struct spi_board_info *spi_boards = NULL; -+static int sun7i_spi_register_spidev(void) -+{ -+ int spi_dev_num = 0; -+ int ret = 0; -+ int i = 0; -+ unsigned int irq_gpio = 0; -+ char spi_board_name[32] = {0}; -+ struct spi_board_info* board; -+ -+ ret = script_parser_fetch("spi_devices", "spi_dev_num", &spi_dev_num, sizeof(int)); -+ if(ret != SCRIPT_PARSER_OK){ -+ spi_err("Get spi devices number failed\n"); -+ return -1; -+ } -+ spi_inf("Found %d spi devices in config files\n", spi_dev_num); -+ -+ /* alloc spidev board information structure */ -+ spi_boards = (struct spi_board_info*)kzalloc(sizeof(struct spi_board_info) * spi_dev_num, GFP_KERNEL); -+ if (spi_boards == NULL) -+ { -+ spi_err("Alloc spi board information failed \n"); -+ return -1; -+ } -+ -+ spi_inf("%-10s %-16s %-16s %-8s %-4s %-4s\n", "boards num", "modalias", "max_spd_hz", "bus_num", "cs", "mode"); -+ for (i=0; imodalias, sizeof(char*)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices modalias failed\n"); -+ goto fail; -+ } -+ ret = script_parser_fetch(spi_board_name, "max_speed_hz", (void*)&board->max_speed_hz, sizeof(int)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices max_speed_hz failed\n"); -+ goto fail; -+ } -+ ret = script_parser_fetch(spi_board_name, "bus_num", (void*)&board->bus_num, sizeof(u16)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices bus_num failed\n"); -+ goto fail; -+ } -+ ret = script_parser_fetch(spi_board_name, "chip_select", (void*)&board->chip_select, sizeof(u16)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices chip_select failed\n"); -+ goto fail; -+ } -+ ret = script_parser_fetch(spi_board_name, "mode", (void*)&board->mode, sizeof(u8)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices mode failed\n"); -+ goto fail; -+ } -+ ret = script_parser_fetch(spi_board_name, "irq_gpio", (void*)&irq_gpio, sizeof(unsigned int)); -+ if (ret != SCRIPT_PARSER_OK) { -+ spi_inf("%s irq gpio not used\n", spi_board_name); -+ board->irq = -1; -+ } else if(gpio_request(irq_gpio, spi_board_name) == 0) -+ board->irq = gpio_to_irq(irq_gpio); -+ /* -+ ret = script_parser_fetch(spi_board_name, "full_duplex", &board->full_duplex, sizeof(int)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices full_duplex failed\n"); -+ goto fail; -+ } -+ ret = script_parser_fetch(spi_board_name, "manual_cs", &board->manual_cs, sizeof(int)); -+ if(ret != SCRIPT_PARSER_OK) { -+ spi_err("Get spi devices manual_cs failed\n"); -+ goto fail; -+ } -+ */ -+ spi_inf("%-10d %-16s %-16d %-8d %-4d 0x%-4d\n", i, board->modalias, board->max_speed_hz, board->bus_num, board->chip_select, board->mode); -+ } -+ -+ /* register boards */ -+ ret = spi_register_board_info(spi_boards, spi_dev_num); -+ if (ret) -+ { -+ spi_err("Register board information failed\n"); -+ goto fail; -+ } -+ return 0; -+fail: -+ if (spi_boards) -+ { -+ kfree(spi_boards); -+ spi_boards = NULL; -+ } -+ return -1; -+ -+} -+ -+static int sun7i_spi_get_cfg_csbitmap(int bus_num) -+{ -+ int value = 0; -+ int ret = 0; -+ char *main_name[] = {"spi0_para", "spi1_para", "spi2_para", "spi3_para"}; -+ char *sub_name = "spi_cs_bitmap"; -+ ret = script_parser_fetch(main_name[bus_num], sub_name, &value, sizeof(int)); -+ if(ret != SCRIPT_PARSER_OK){ -+ spi_err("get spi %d para failed, err code = %d \n", bus_num, ret); -+ return 0; -+ } -+ spi_inf("bus num = %d, spi used = %d \n", bus_num, value); -+ return value; -+ -+} -+ -+#ifdef CONFIG_SUN7I_SPI_NORFLASH -+#include -+#include -+ -+/*struct mtd_partition part = { -+ .name = "p1", -+ .size = 8388608, -+ .offset = 0, -+};*/ -+ -+static struct flash_platform_data at25df641_info = { -+ .name = "m25p80", -+ .parts = NULL, -+ .nr_parts = 0, -+ .type = "at25df641", -+}; -+ -+static struct spi_board_info norflash = { -+ .modalias = "m25p80", -+ .platform_data = &at25df641_info, -+ .mode = SPI_MODE_0, -+ .irq = 0, -+ .max_speed_hz = 10 * 1000 * 1000, -+ .bus_num = 0, -+ .chip_select = 0, -+}; -+ -+static void __init sun7i_spi_norflash(void) -+{ -+ if (spi_register_board_info(&norflash, 1)) { -+ spi_err("%s: Register norflash:%s information failed\n", -+ __func__, at25df641_info.type); -+ } else { -+ spi_inf("%s: Register norflash:%s information OK\n", -+ __func__, at25df641_info.type); -+ } -+} -+#else -+static void __init sun7i_spi_norflash(void) -+{} -+#endif /* CONFIG_SUN7I_SPI_NORFLASH */ -+ -+/* get configuration in the script */ -+#define SPI0_USED_MASK 0x1 -+#define SPI1_USED_MASK 0x2 -+#define SPI2_USED_MASK 0x4 -+#define SPI3_USED_MASK 0x8 -+static int spi_used = 0; -+ -+static int __init spi_sun7i_init(void) -+{ -+ int used = 0; -+ int i = 0; -+ int ret = 0; -+ char spi_para[16] = {0}; -+ -+ spi_dbg("sw spi init !!\n"); -+ spi_used = 0; -+ for (i=0; i<4; i++) -+ { -+ used = 0; -+ sprintf(spi_para, "spi%d_para", i); -+ ret = script_parser_fetch(spi_para, "spi_used", &used, sizeof(int)); -+ if (ret) -+ { -+ spi_err("sw spi init fetch spi%d uning configuration failed\n", i); -+ continue; -+ } -+ if (used) -+ spi_used |= 1 << i; -+ } -+ -+ ret = sun7i_spi_register_spidev(); -+ if (ret) -+ { -+ spi_err("register spi devices board info failed \n"); -+ } -+ -+// sun7i_spi_norflash(); -+ -+ if (spi_used & SPI0_USED_MASK) -+ platform_device_register(&sun7i_spi0_device); -+ if (spi_used & SPI1_USED_MASK) -+ platform_device_register(&sun7i_spi1_device); -+ if (spi_used & SPI2_USED_MASK) -+ platform_device_register(&sun7i_spi2_device); -+ if (spi_used & SPI3_USED_MASK) -+ platform_device_register(&sun7i_spi3_device); -+ -+ if (spi_used) -+ { -+ return platform_driver_register(&sun7i_spi_driver); -+ } -+ else -+ { -+ pr_warning("spi: cannot find any using configuration for \ -+ all 4 spi controllers, return directly!\n"); -+ return 0; -+ } -+} -+ -+static void __exit spi_sun7i_exit(void) -+{ -+ if (spi_used & SPI0_USED_MASK) -+ platform_device_unregister(&sun7i_spi0_device); -+ if (spi_used & SPI1_USED_MASK) -+ platform_device_unregister(&sun7i_spi1_device); -+ if (spi_used & SPI2_USED_MASK) -+ platform_device_unregister(&sun7i_spi2_device); -+ if (spi_used & SPI3_USED_MASK) -+ platform_device_unregister(&sun7i_spi3_device); -+ -+ if (spi_used) -+ platform_driver_unregister(&sun7i_spi_driver); -+ kfree(spi_boards); -+} -+ -+module_init(spi_sun7i_init); -+module_exit(spi_sun7i_exit); -+ -+MODULE_AUTHOR("pannan"); -+MODULE_DESCRIPTION("SUN7I SPI BUS Driver"); -+MODULE_ALIAS("platform:sun7i-spi"); -+MODULE_LICENSE("GPL"); diff --git a/patch/u-boot/bananapi_enable_usb_otg.patch b/patch/u-boot/bananapi_enable_usb_otg.patch deleted file mode 100644 index d19b9fbf8..000000000 --- a/patch/u-boot/bananapi_enable_usb_otg.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configs/Bananapi_defconfig -+++ b/configs/Bananapi_defconfig -@@ -14,3 +14,8 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC - CONFIG_NETCONSOLE=y - CONFIG_ETH_DESIGNWARE=y - CONFIG_USB_EHCI_HCD=y -+CONFIG_USB0_ID_DET="PH04" -+CONFIG_USB0_VBUS_DET="PH05" -+CONFIG_USB0_VBUS_PIN="PB09" -+CONFIG_USB_MUSB_SUNXI=y -+CONFIG_USB_MUSB_GADGET=y diff --git a/patch/u-boot/second_sd_card_cubieboard2.patch b/patch/u-boot/second_sd_card_cubieboard2.patch deleted file mode 100644 index 651624879..000000000 --- a/patch/u-boot/second_sd_card_cubieboard2.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/configs/Cubieboard2_defconfig b/configs/Cubieboard2_defconfig -index 0fbaa23..5ba97a6 100644 ---- a/configs/Cubieboard2_defconfig -+++ b/configs/Cubieboard2_defconfig -@@ -15,3 +15,5 @@ CONFIG_ETH_DESIGNWARE=y - CONFIG_DM_SERIAL=y - CONFIG_USB=y - CONFIG_DM_USB=y -+CONFIG_MMC2_CD_PIN="PH0" -+CONFIG_MMC_SUNXI_SLOT_EXTRA=2 diff --git a/patch/u-boot/udoo-uboot-fatboot.patch b/patch/u-boot/udoo-uboot-fatboot.patch deleted file mode 100644 index 8036b3a44..000000000 --- a/patch/u-boot/udoo-uboot-fatboot.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/include/configs/udoo.h -+++ b/include/configs/udoo.h -@@ -103,7 +103,7 @@ - #endif - - #define CONFIG_EXTRA_ENV_SETTINGS \ -- "script=uEnv.txt\0" \ -+ "script=/boot/boot.scr\0" \ - "image=zImage\0" \ - "console=ttymxc1\0" \ - "splashpos=m,m\0" \ -@@ -133,10 +133,9 @@ - "mmcargs=setenv bootargs console=${console},${baudrate} ${video} ${memory} " \ - "root=${mmcroot}\0" \ - "loadbootscript=" \ -- "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ -- "env import -t ${loadaddr} ${filesize}; " \ -- "run uenvboot\0" \ -+ "source\0" \ - "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ -@@ -180,15 +179,16 @@ - "fi;\0" - - #define CONFIG_BOOTCOMMAND \ -- "mmc dev ${mmcdev}; " \ -- "if mmc rescan; then " \ -- "if run loadbootscript; then " \ -- "run bootscript; fi; " \ -- "if run loadimage; then " \ -- "run mmcboot; " \ -- "else run netboot; " \ -- "fi; " \ -- "else run netboot; fi" -+ "mmc dev ${mmcdev}; if mmc rescan; then " \ -+ "if run loadbootscript; then " \ -+ "run bootscript; " \ -+ "else " \ -+ "if run loadimage; then " \ -+ "run mmcboot; " \ -+ "else run netboot; " \ -+ "fi; " \ -+ "fi; " \ -+ "else run netboot; fi" - - /* Miscellaneous configurable options */ - #define CONFIG_SYS_LONGHELP diff --git a/patch/u-boot/udoo.h b/patch/u-boot/udoo.h deleted file mode 100644 index 86922214e..000000000 --- a/patch/u-boot/udoo.h +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2013 Freescale Semiconductor, Inc. - * - * Configuration settings for Udoo board. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef __CONFIG_H -#define __CONFIG_H - -#include "mx6_common.h" -#include -#include -#include - -#define CONFIG_MX6 -#define CONFIG_DISPLAY_CPUINFO -#define CONFIG_DISPLAY_BOARDINFO - -#define MACH_TYPE_UDOO 4800 -#define CONFIG_MACH_TYPE MACH_TYPE_UDOO - -#define CONFIG_CMDLINE_TAG -#define CONFIG_SETUP_MEMORY_TAGS -#define CONFIG_INITRD_TAG -#define CONFIG_REVISION_TAG - -/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (2 * SZ_1M) - -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_MXC_GPIO - -#define CONFIG_MXC_UART -#define CONFIG_MXC_UART_BASE UART2_BASE - -/* SATA Configs */ - -#define CONFIG_CMD_SATA -#ifdef CONFIG_CMD_SATA -#define CONFIG_DWC_AHSATA -#define CONFIG_SYS_SATA_MAX_DEVICE 1 -#define CONFIG_DWC_AHSATA_PORT_ID 0 -#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR -#define CONFIG_LBA48 -#define CONFIG_LIBATA -#endif - -/* Network support */ - -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_MII -#define CONFIG_CMD_NET -#define CONFIG_FEC_MXC -#define CONFIG_MII -#define IMX_FEC_BASE ENET_BASE_ADDR -#define CONFIG_FEC_XCV_TYPE RGMII -#define CONFIG_ETHPRIME "FEC" -#define CONFIG_FEC_MXC_PHYADDR 6 -#define CONFIG_PHYLIB -#define CONFIG_PHY_MICREL -#define CONFIG_PHY_MICREL_KSZ9031 - -/* allow to overwrite serial and ethaddr */ -#define CONFIG_ENV_OVERWRITE -#define CONFIG_CONS_INDEX 1 -#define CONFIG_BAUDRATE 115200 - -/* Command definition */ -#include - -#undef CONFIG_CMD_IMLS - -#define CONFIG_CMD_BMODE -#define CONFIG_CMD_SETEXPR - -#define CONFIG_BOOTDELAY 3 - -#define CONFIG_SYS_MEMTEST_START 0x10000000 -#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) -#define CONFIG_LOADADDR 0x12000000 -#define CONFIG_SYS_TEXT_BASE 0x17800000 - -/* MMC Configuration */ -#define CONFIG_FSL_ESDHC -#define CONFIG_FSL_USDHC -#define CONFIG_SYS_FSL_ESDHC_ADDR 0 - -#define CONFIG_MMC -#define CONFIG_CMD_MMC -#define CONFIG_GENERIC_MMC -#define CONFIG_BOUNCE_BUFFER -#define CONFIG_CMD_EXT2 -#define CONFIG_CMD_FAT -#define CONFIG_DOS_PARTITION - -#if defined(CONFIG_MX6Q) -#define CONFIG_DEFAULT_FDT_FILE "imx6q-udoo.dtb" -#else -#define CONFIG_DEFAULT_FDT_FILE "imx6dl-udoo.dtb" -#endif - -#define CONFIG_EXTRA_ENV_SETTINGS \ - "script=boot.scr\0" \ - "image=zImage\0" \ - "console=ttymxc1\0" \ - "splashpos=m,m\0" \ - "fdt_high=0xffffffff\0" \ - "initrd_high=0xffffffff\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ - "fdt_addr=0x18000000\0" \ - "boot_fdt=try\0" \ - "ip_dyn=yes\0" \ - "mmcdev=0\0" \ - "mmcpart=1\0" \ - "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ - "update_sd_firmware_filename=u-boot.imx\0" \ - "update_sd_firmware=" \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "if mmc dev ${mmcdev}; then " \ - "if ${get_cmd} ${update_sd_firmware_filename}; then " \ - "setexpr fw_sz ${filesize} / 0x200; " \ - "setexpr fw_sz ${fw_sz} + 1; " \ - "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ - "fi; " \ - "fi\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} ${video} ${memory} " \ - "root=${mmcroot}\0" \ - "loadbootscript=" \ - "ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/${script} || fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source\0" \ - "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ - "bootz; " \ - "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${image}; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ - "bootz; " \ - "fi;\0" - -#define CONFIG_BOOTCOMMAND \ - "mmc dev ${mmcdev}; if mmc rescan; then " \ - "if run loadbootscript; then " \ - "run bootscript; " \ - "else " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "fi; " \ - "else run netboot; fi" - -/* Miscellaneous configurable options */ -#define CONFIG_SYS_LONGHELP -#define CONFIG_SYS_HUSH_PARSER -#define CONFIG_SYS_PROMPT "=> " -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_CBSIZE 256 - -/* Print Buffer Size */ -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE - -#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR - -#define CONFIG_CMDLINE_EDITING - -/* Physical Memory Map */ -#define CONFIG_NR_DRAM_BANKS 1 -#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR - -#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM -#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR -#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE - -#define CONFIG_SYS_INIT_SP_OFFSET \ - (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -#define CONFIG_SYS_INIT_SP_ADDR \ - (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) - -/* FLASH and environment organization */ -#define CONFIG_SYS_NO_FLASH - -#define CONFIG_ENV_SIZE (8 * 1024) - -#define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET (6 * 64 * 1024) -#define CONFIG_SYS_MMC_ENV_DEV 0 - -#define CONFIG_OF_LIBFDT -#define CONFIG_CMD_BOOTZ - -#ifndef CONFIG_SYS_DCACHE_OFF -#define CONFIG_CMD_CACHE -#endif - -#endif /* __CONFIG_H * */ diff --git a/patch/u-boot/udoo_neo.h b/patch/u-boot/udoo_neo.h deleted file mode 100644 index 3f825aade..000000000 --- a/patch/u-boot/udoo_neo.h +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (C) Jasbir Matharu - * Copyright (C) 2014 Freescale Semiconductor, Inc. - * - * Configuration settings for the UDOO NEO board. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef __MX6SX_UDOONEO_CONFIG_H -#define __MX6SX_UDOONEO_CONFIG_H - -#include -#include -#include "mx6_common.h" -#include - -#define CONFIG_MX6 -#define CONFIG_ROM_UNIFIED_SECTIONS -#define CONFIG_SYS_GENERIC_BOARD -#define CONFIG_DISPLAY_CPUINFO -#define CONFIG_DISPLAY_BOARDINFO - -#define CONFIG_DBG_MONITOR -/* uncomment for PLUGIN mode support */ -/* #define CONFIG_USE_PLUGIN */ - -/* uncomment for SECURE mode support */ -/* #define CONFIG_SECURE_BOOT */ - -#define CONFIG_CMDLINE_TAG -#define CONFIG_SETUP_MEMORY_TAGS -#define CONFIG_INITRD_TAG -#define CONFIG_REVISION_TAG - -/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (16 * SZ_1M) - -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_BOARD_LATE_INIT -#define CONFIG_MXC_GPIO - -#define CONFIG_MXC_UART -#define CONFIG_MXC_UART_BASE UART1_BASE - -#define CONFIG_CMD_FUSE -#ifdef CONFIG_CMD_FUSE -#define CONFIG_MXC_OCOTP -#endif - -/* MMC Configs */ -#define CONFIG_FSL_ESDHC -#define CONFIG_FSL_USDHC -#define CONFIG_SYS_FSL_ESDHC_ADDR 0 -#define CONFIG_SYS_FSL_USDHC_NUM 2 - -#define CONFIG_MMC -#define CONFIG_CMD_MMC -#define CONFIG_GENERIC_MMC -#define CONFIG_CMD_FAT -#define CONFIG_DOS_PARTITION -#define CONFIG_CMD_EXT2 -#undef CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ - -#define CONFIG_BAUDRATE 115200 - -#undef CONFIG_BOOTM_NETBSD -#undef CONFIG_BOOTM_PLAN9 -#undef CONFIG_BOOTM_RTEMS - -// needed for uEnv.txt support -//#undef CONFIG_CMD_EXPORTENV -//#undef CONFIG_CMD_IMPORTENV - -#undef CONFIG_CMD_PING -#undef CONFIG_CMD_DHCP -#undef CONFIG_CMD_MII -#undef CONFIG_CMD_NET -#undef CONFIG_FEC_MXC -#undef CONFIG_MII -#define CONFIG_FEC_ENET_DEV 0 - -#if (CONFIG_FEC_ENET_DEV == 0) -#define IMX_FEC_BASE ENET_BASE_ADDR -#define CONFIG_FEC_MXC_PHYADDR 0x1 -#elif (CONFIG_FEC_ENET_DEV == 1) -#define IMX_FEC_BASE ENET2_BASE_ADDR -#define CONFIG_FEC_MXC_PHYADDR 0x2 -#endif -#define CONFIG_FEC_XCV_TYPE RGMII -#define CONFIG_ETHPRIME "FEC" - -#define CONFIG_PHYLIB -#define CONFIG_PHY_ATHEROS -#define CONFIG_FEC_DMA_MINALIGN 64 -#define CONFIG_FEC_MXC_25M_REF_CLK - -/* allow to overwrite serial and ethaddr */ -#define CONFIG_ENV_OVERWRITE -#define CONFIG_CONS_INDEX 1 - -/* I2C configs */ -#define CONFIG_CMD_I2C -#define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_MXC -#define CONFIG_SYS_I2C_SPEED 100000 - -/* PMIC */ -#define CONFIG_PFUZE300_PMIC_I2C -#ifdef CONFIG_PFUZE300_PMIC_I2C -#define CONFIG_PMIC_I2C_BUS 0 -#define CONFIG_PMIC_I2C_SLAVE 0x8 -#endif - -/* Command definition */ -#include - -#undef CONFIG_CMD_IMLS - -#define CONFIG_BOOTDELAY 3 - -#define CONFIG_LOADADDR 0x80800000 -#define CONFIG_SYS_TEXT_BASE 0x87800000 - -#define CONFIG_SYS_AUXCORE_BOOTDATA 0x78000000 /* Set to QSPI2 B flash at default */ -#ifndef CONFIG_SYS_AUXCORE_FASTUP -#define CONFIG_CMD_BOOTAUX /* Boot M4 by command, disable this when M4 fast up */ -#define CONFIG_CMD_SETEXPR -#endif - -#ifdef CONFIG_CMD_BOOTAUX -#define UPDATE_M4_ENV \ - "m4image=m4_qspi.bin\0" \ - "loadm4image=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}\0" \ - "update_m4_from_sd=" \ - "if sf probe 1:0; then " \ - "if run loadm4image; then " \ - "setexpr fw_sz ${filesize} + 0xffff; " \ - "setexpr fw_sz ${fw_sz} / 0x10000; " \ - "setexpr fw_sz ${fw_sz} * 0x10000; " \ - "sf erase 0x0 ${fw_sz}; " \ - "sf write ${loadaddr} 0x0 ${filesize}; " \ - "fi; " \ - "fi\0" \ - "m4boot=sf probe 1:0; bootaux "__stringify(CONFIG_SYS_AUXCORE_BOOTDATA)"\0" -#else -#define UPDATE_M4_ENV "" -#endif - -#ifdef CONFIG_VIDEO -#define CONFIG_VIDEO_MODE \ - "panel=" CONFIG_VIDEO_PANEL "\0" -#else -#define CONFIG_VIDEO_MODE "" -#endif - -#define CONFIG_MFG_ENV_SETTINGS \ - "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ - "rdinit=/linuxrc " \ - "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ - "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ - "g_mass_storage.iSerialNumber=\"\" "\ - "\0" \ - "initrd_addr=0x83800000\0" \ - "initrd_high=0xffffffff\0" \ - "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ - -#define CONFIG_EXTRA_ENV_SETTINGS \ - CONFIG_MFG_ENV_SETTINGS \ - UPDATE_M4_ENV \ - CONFIG_VIDEO_MODE \ - "script=boot.scr\0" \ - "boot_prefixes=/ /boot/\0" \ - "boot_a_script=ext2load mmc 0 ${loadaddr} ${prefix}${script}; source ${loadaddr} || fatload mmc 0 ${loadaddr} ${prefix}${script}; source ${loadaddr}\0" \ - "scan_dev_for_boot=echo Scanning mmc ; for prefix in ${boot_prefixes}; do run scan_dev_for_scripts; done\0" \ - "scan_dev_for_scripts=if test -e mmc 0 ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; else echo Checking here ${prefix} ... not found; fi;\0" \ - "image=/zImage\0" \ - "console=ttymxc0\0" \ - "fdt_high=0xffffffff\0" \ - "initrd_high=0xffffffff\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ - "fdt_addr=0x83000000\0" \ - "boot_fdt=try\0" \ - "ip_dyn=yes\0" \ - "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ - "mmcpart=1\0" \ - "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ - "mmcautodetect=no\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=${mmcroot} consoleblank=0\0" \ - "loadbootscript=" \ - "run scan_dev_for_boot;\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "env import -t ${loadaddr} ${filesize}; " \ - "run uenvboot\0" \ - "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ - "bootz; " \ - "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${image}; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ - "bootz; " \ - "fi;\0" - -#define CONFIG_BOOTCOMMAND \ - "mmc dev ${mmcdev}; " \ - "if mmc rescan; then " \ - "if run loadbootscript; then " \ - "run bootscript; " \ - "fi; " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "else run netboot; fi" - -/* Miscellaneous configurable options */ -#define CONFIG_SYS_LONGHELP -#define CONFIG_SYS_HUSH_PARSER -#define CONFIG_SYS_PROMPT "=> " -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_CBSIZE 1024 - -/* Print Buffer Size */ -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -#define CONFIG_SYS_MAXARGS 256 -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE - -#define CONFIG_CMD_MEMTEST -#define CONFIG_SYS_MEMTEST_START 0x80000000 -#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x10000) - -#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR -#define CONFIG_SYS_HZ 1000 - -#define CONFIG_CMDLINE_EDITING -#define CONFIG_STACKSIZE SZ_128K - -/* Physical Memory Map */ -#define CONFIG_NR_DRAM_BANKS 1 -#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR - -#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM -#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR -#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE - -#define CONFIG_SYS_INIT_SP_OFFSET \ - (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -#define CONFIG_SYS_INIT_SP_ADDR \ - (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) - -/* FLASH and environment organization */ -#define CONFIG_SYS_NO_FLASH - -#define CONFIG_ENV_SIZE SZ_8K - -#ifdef CONFIG_SYS_AUXCORE_FASTUP -/*#define CONFIG_MXC_RDC*/ /* Disable the RDC temporarily, will enable it in future */ -#define CONFIG_ENV_IS_IN_MMC /* Must disable QSPI driver, because M4 run on QSPI */ -#elif defined CONFIG_SYS_BOOT_QSPI -#define CONFIG_SYS_USE_QSPI -#define CONFIG_ENV_IS_IN_SPI_FLASH -#else -#define CONFIG_SYS_USE_QSPI /* Enable the QSPI flash at default */ -#define CONFIG_ENV_IS_IN_MMC -#endif - -#ifdef CONFIG_SYS_USE_QSPI -#define CONFIG_QSPI /* enable the QUADSPI driver */ -#define CONFIG_QSPI_BASE QSPI2_BASE_ADDR -#define CONFIG_QSPI_MEMMAP_BASE QSPI2_ARB_BASE_ADDR - -#define CONFIG_CMD_SF -#define CONFIG_SPI_FLASH -#define CONFIG_SPI_FLASH_BAR -#define CONFIG_SPI_FLASH_SPANSION -#define CONFIG_SPI_FLASH_STMICRO -#define CONFIG_SF_DEFAULT_BUS 0 -#define CONFIG_SF_DEFAULT_CS 0 -#define CONFIG_SF_DEFAULT_SPEED 40000000 -#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 -#endif - -#define CONFIG_SYS_MMC_ENV_DEV 0 /*USDHC2*/ -#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */ -#define CONFIG_MMCROOT "/dev/mmcblk0p2" /* USDHC2 */ - -#if defined(CONFIG_ENV_IS_IN_MMC) -#define CONFIG_ENV_OFFSET (8 * SZ_64K) -#elif defined(CONFIG_ENV_IS_IN_SPI_FLASH) -#define CONFIG_ENV_OFFSET (768 * 1024) -#define CONFIG_ENV_SECT_SIZE (64 * 1024) -#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS -#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS -#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE -#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED -#endif - - -#define CONFIG_OF_LIBFDT -#define CONFIG_CMD_BOOTZ - -#define CONFIG_CMD_BMODE - -#ifndef CONFIG_SYS_DCACHE_OFF -#define CONFIG_CMD_CACHE -#endif - -#ifdef CONFIG_VIDEO -#define CONFIG_CFB_CONSOLE -#define CONFIG_VIDEO_MXS -#define CONFIG_VIDEO_LOGO -#define CONFIG_VIDEO_SW_CURSOR -#define CONFIG_VGA_AS_SINGLE_DEVICE -#define CONFIG_SYS_CONSOLE_IS_IN_ENV -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SPLASH_SCREEN_ALIGN -#define CONFIG_CMD_BMP -#define CONFIG_BMP_16BPP -#define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_VIDEO_BMP_LOGO -#ifdef CONFIG_VIDEO_GIS -#define CONFIG_VIDEO_CSI -#define CONFIG_VIDEO_PXP -#define CONFIG_VIDEO_VADC -#endif -#endif - -#define CONFIG_CMD_USB -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_MX6 -#define CONFIG_USB_STORAGE -#define CONFIG_EHCI_HCD_INIT_AFTER_RESET -#define CONFIG_USB_HOST_ETHER -#define CONFIG_USB_ETHER_ASIX -#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) -#define CONFIG_MXC_USB_FLAGS 0 -#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 - -/* - * The PCIe support in uboot would bring failures in i.MX6SX PCIe - * EP/RC validations. Disable PCIe support in uboot here. - * RootCause: The bit10(ltssm_en) of GPR12 would be set in uboot, - * thus the i.MX6SX PCIe EP would be cheated that the other i.MX6SX - * PCIe RC had been configured and trying to setup PCIe link directly, - * although the i.MX6SX RC is not properly configured at that time. - * PCIe can be supported in uboot, if the i.MX6SX PCIe EP/RC validation - * is not running. - */ -/* #define CONFIG_CMD_PCI */ -#ifdef CONFIG_CMD_PCI -#define CONFIG_PCI -#define CONFIG_PCI_PNP -#define CONFIG_PCI_SCAN_SHOW -#define CONFIG_PCIE_IMX -#define CONFIG_PCIE_IMX_PERST_GPIO IMX_GPIO_NR(2, 0) -#define CONFIG_PCIE_IMX_POWER_GPIO IMX_GPIO_NR(2, 1) -#endif - -#endif /* __CONFIG_H */