Merge branch 'internal'
authorYaniv Machani <yanivma@ti.com>
Tue, 31 May 2016 08:08:57 +0000 (11:08 +0300)
committerYaniv Machani <yanivma@ti.com>
Tue, 31 May 2016 08:08:57 +0000 (11:08 +0300)
63 files changed:
build_wl18xx.sh
configuration.sh
configuration/kernel_4.4.config [changed mode: 0755->0644]
patches/driver_patches/imx-3.10.53/0001-completion-remove-reinit_completion-decleration.patch [deleted file]
patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-e14-wl1837-cape-suppor.patch [new file with mode: 0644]
patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-su-wl1837-audio-cape-s.patch [new file with mode: 0644]
patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-wl1835-cape-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0002-Bluetooth-Add-tty-HCI-driver.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0006-btwilink-add-minimal-device-tree-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0007-ti-st-add-device-tree-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0011-imx6q-sabresd-update-wilink8-entries-for-r8.6.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0012-imx6sl-evk-update-wilink8-entries-for-r8.6.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0013-imx_v7_android_defconfig-enable-Wilink8-related-swit.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0014-drivers-misc-ti-st-fix-debugfs-creation-error-handli.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0015-drivers-misc-ti-st-fix-null-pointer-exception-in-st_.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/device-fsl-patches/0001-sabresd_6dq-add-wilink8-platform-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch
patches/kernel_patches/imx-3.10.53/0002-Bluetooth-Add-tty-HCI-driver.patch
patches/kernel_patches/imx-3.10.53/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch
patches/kernel_patches/imx-3.10.53/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch
patches/kernel_patches/imx-3.10.53/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch
patches/kernel_patches/imx-3.10.53/0006-btwilink-add-minimal-device-tree-support.patch
patches/kernel_patches/imx-3.10.53/0007-ti-st-add-device-tree-support.patch
patches/kernel_patches/imx-3.10.53/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch
patches/kernel_patches/imx-3.10.53/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch
patches/kernel_patches/imx-3.10.53/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53/0011-imx6q-sabresd-update-wilink8-entries-for-r8.6.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.10.53/0012-imx6sl-evk-update-wilink8-entries-for-r8.6.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0002-Bluetooth-Add-tty-HCI-driver.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0006-btwilink-add-minimal-device-tree-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0007-ti-st-add-device-tree-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.28/Readme.txt [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0002-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0003-Bluetooth-Add-tty-HCI-driver.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0004-imx_v7_defconfig-enable-Wilink8-related-switches.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0005-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0006-st_kim-allow-suspend-if-callback-is-not-registered.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0007-btwilink-add-minimal-device-tree-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0008-ti-st-add-device-tree-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0009-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0010-imx_v7_android_defconfig-enable-Wilink8-related-swit.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0011-drivers-misc-ti-st-fix-debugfs-creation-error-handli.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0012-drivers-misc-ti-st-fix-null-pointer-exception-in-st_.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/device-fsl-patches/0001-sabresd_6dq-add-wilink8-wlan-platform-support.patch [new file with mode: 0644]
patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/external-sepolicy-patches/0001-sepolicy-enable-loading-of-modules.patch [new file with mode: 0644]
patches/kernel_patches/linux-4.1-at91/0001-mmc-sdhci-restore-behavior-when-setting-VDD-via-exte.patch [new file with mode: 0644]
patches/kernel_patches/linux-4.1-at91/0002-sama5d2_xplained-add-wilink8-wifi-support.patch [new file with mode: 0644]
verify_kernel_config.sh

index b95ab692465d66e54324f45ad2fc88298dfb2986..c8f125b63352166e1cbcdabf3c24e2555cac3d04 100755 (executable)
@@ -29,6 +29,7 @@ function usage ()
     echo "                          update       <head|TAG>  [ Update to specific TAG & Build ] "
     echo "                          clean                    [ Clean & Build                  ] "
     echo "                          <empty>                  [ Build w/o update               ] "
+     echo "                         all_intree               [ Build driver and kernel intree ] " 
     echo "                          check_updates            [ Check for build script updates ] "
     echo ""
     echo "Building specific component :"
@@ -256,7 +257,7 @@ function setup_branches()
         if [[ "$url" == *git.ti.com* ]]
         then            
            [[ -n $RESET ]] && echo -e "${PURPLE}Reset to latest in repo ${GREEN}$name ${NORMAL} branch  ${GREEN}$branch ${NORMAL}"  && git reset --hard origin/$branch
-           [[ -n $USE_TAG ]] && git reset --hard $USE_TAG  && echo -e "${NORMAL}Reset to tag ${GREEN}$USE_TAG   ${NORMAL}in repo ${GREEN}$name ${NORMAL} "            
+           [[ -n $USE_TAG ]] && git checkout $USE_TAG  && echo -e "${NORMAL}Reset to tag ${GREEN}$USE_TAG   ${NORMAL}in repo ${GREEN}$name ${NORMAL} "            
         fi        
                cd_back
                i=$[$i + 3]
index 889a14f2e2e9ae3338e06cf2b23dde36879df949..e8f25c67a8adc58a5c0302bc1dbf12780e7fcf37 100755 (executable)
@@ -49,7 +49,7 @@ processor-sdk-linux-02.00.01
 
 openssl
 git://github.com/openssl/openssl
-OpenSSL_1_0_1g
+OpenSSL_1_0_2d
 
 libnl
 git://github.com/tgraf/libnl.git
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/patches/driver_patches/imx-3.10.53/0001-completion-remove-reinit_completion-decleration.patch b/patches/driver_patches/imx-3.10.53/0001-completion-remove-reinit_completion-decleration.patch
deleted file mode 100644 (file)
index a868c60..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-From da226aa1fd87531f596c2c351dd41fbab3dd44cb Mon Sep 17 00:00:00 2001
-From: Eyal Reizer <eyalr@ti.com>
-Date: Mon, 9 Mar 2015 10:07:44 +0200
-Subject: [PATCH] completion: remove reinit_completion decleration
-
-This api is already backported into the imx 3.10.53 kernel
-
-Signed-off-by: Eyal Reizer <eyalr@ti.com>
----
- backport-include/linux/completion.h |   14 --------------
- 1 file changed, 14 deletions(-)
-
-diff --git a/backport-include/linux/completion.h b/backport-include/linux/completion.h
-index 399430d..f3734ef 100644
---- a/backport-include/linux/completion.h
-+++ b/backport-include/linux/completion.h
-@@ -3,18 +3,4 @@
- #include_next <linux/completion.h>
- #include <linux/version.h>
--#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
--/**
-- * reinit_completion - reinitialize a completion structure
-- * @x:  pointer to completion structure that is to be reinitialized
-- *
-- * This inline function should be used to reinitialize a completion structure so it can
-- * be reused. This is especially important after complete_all() is used.
-- */
--static inline void reinit_completion(struct completion *x)
--{
--      x->done = 0;
--}
--#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
--
- #endif /* __BACKPORT_COMPLETION_H */
--- 
-1.7.9.5
-
diff --git a/patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-e14-wl1837-cape-suppor.patch b/patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-e14-wl1837-cape-suppor.patch
new file mode 100644 (file)
index 0000000..0e28b58
--- /dev/null
@@ -0,0 +1,193 @@
+From 57cf1aad225bc6961e2e4b49b091ad7d0f0f5a86 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 2 Nov 2015 12:15:53 +0200
+Subject: [PATCH] ARCH:arm:am335x-boneblack: add e14 wl1837 cape support
+
+* enable mmc2 used for wlan and uart1 used for bluetooth
+* configure the gpios used for wlan and bluetooth controls
+* add fixed voltage regulator used for wlan power control
+* enable i2c1 used for mfi control
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/am335x-bone-e14-wl1837.dtsi |  156 +++++++++++++++++++++++++
+ arch/arm/boot/dts/am335x-boneblack.dts        |    3 +
+ 2 files changed, 159 insertions(+)
+ create mode 100644 arch/arm/boot/dts/am335x-bone-e14-wl1837.dtsi
+
+diff --git a/arch/arm/boot/dts/am335x-bone-e14-wl1837.dtsi b/arch/arm/boot/dts/am335x-bone-e14-wl1837.dtsi
+new file mode 100644
+index 0000000..2772216
+--- /dev/null
++++ b/arch/arm/boot/dts/am335x-bone-e14-wl1837.dtsi
+@@ -0,0 +1,156 @@
++/*
++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <dt-bindings/interrupt-controller/irq.h>
++
++/ {
++      model = "TI AM335x BeagleBone Black";
++      compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
++
++      wlan_en_reg: fixedregulator@1 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++              gpio = <&gpio0 2 0>;
++              enable-active-high;
++      };
++
++      kim {
++              compatible = "kim";
++              nshutdown_gpio = <3>; /* Bank0, pin3 */
++              dev_name = "/dev/ttyO1";
++              flow_cntrl = <1>;
++              baud_rate = <3000000>;
++      };
++
++      btwilink {
++              compatible = "btwilink";
++      };
++};
++
++&am33xx_pinmux {
++      pinctrl-0 = <&clkout2_pin>;
++
++      uart1_pins_default: pinmux_uart1_pins_default {
++              pinctrl-single,pins = <
++                      0x180 ( PIN_INPUT  | MUX_MODE0 ) /* (D16) uart1_rxd.uart1_rxd */
++                      0x184 ( PIN_OUTPUT | MUX_MODE0 ) /* (D15) uart1_txd.uart1_txd */
++                      0x178 ( PIN_INPUT  | MUX_MODE0 ) /* (D18) uart1_ctsn.uart1_ctsn */
++                      0x17c ( PIN_OUTPUT_PULLDOWN | MUX_MODE0 ) /* (D17) uart1_rtsn.uart1_rtsn */
++              >;
++      };
++
++      uart1_pins_sleep: pinmux_uart1_pins_sleep {
++              pinctrl-single,pins = <
++                      0x180 ( PIN_INPUT  | MUX_MODE0 ) /* (D16) uart1_rxd.uart1_rxd */
++                      0x184 ( PIN_OUTPUT | MUX_MODE0 ) /* (D15) uart1_txd.uart1_txd */
++                      0x178 ( PIN_INPUT  | MUX_MODE0 ) /* (D18) uart1_ctsn.uart1_ctsn */
++                      0x17c ( PIN_OUTPUT | MUX_MODE0 ) /* (D17) uart1_rtsn.uart1_rtsn  */
++              >;
++      };
++
++      bt_pins_default: pinmux_bt_pins_default {
++              pinctrl-single,pins = <
++                      0x154 (PIN_OUTPUT_PULLUP   | MUX_MODE7) /* gpio0_3 BT_EN*/
++              >;
++      };
++
++      bt_pins_sleep: pinmux_bt_pins_sleep {
++              pinctrl-single,pins = <
++                      0x154 (PIN_OUTPUT_PULLUP   | MUX_MODE7) /* gpio0_3 BT_EN*/
++              >;
++      };
++
++      mmc2_pins: pinmux_mmc2_pins {
++              pinctrl-single,pins = <
++                      0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
++                      0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
++                      0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
++                      0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
++                      0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
++                      0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
++              >;
++      };
++
++      mmc2_pins_sleep: pinmux_mmc2_pins_sleep {
++              pinctrl-single,pins = <
++                      0x80 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn1.mmc1_clk */
++                      0x84 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn2.mmc1_cmd */
++                      0x00 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad0.mmc1_dat0 */
++                      0x04 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad1.mmc1_dat1 */
++                      0x08 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad2.mmc1_dat2 */
++                      0x0c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad3.mmc1_dat3 */
++              >;
++      };
++
++      wlan_pins_default: pinmux_wlan_pins_default {
++              pinctrl-single,pins = <
++                      0x150 (PIN_OUTPUT_PULLUP   | MUX_MODE7) /* gpio0_2 WL_EN*/
++                      0x164 (PIN_INPUT_PULLUP    | MUX_MODE7) /* gpio0_7 WL_IRQ*/
++                      0x7C  (PIN_OUTPUT_PULLUP   | MUX_MODE0) /* gpmc_csn0.gpio1_29 Cape_Buffer_EN*/
++                      0x90  (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2  Audio_sync*/
++              >;
++      };
++
++      wlan_pins_sleep: pinmux_wlan_pins_sleep {
++              pinctrl-single,pins = <
++                      0x150 (PIN_OUTPUT_PULLUP   | MUX_MODE7) /* gpio0_2 WL_EN*/
++                      0x164 (PIN_INPUT_PULLUP    | MUX_MODE7) /* gpio0_7 WL_IRQ*/
++                      0x7C  (PIN_OUTPUT_PULLUP   | MUX_MODE0) /* gpmc_csn0.gpio1_29 Cape_Buffer_EN*/
++                      0x90  (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2  Audio_sync*/
++              >;
++      };
++
++      i2c1_pins: pinmux_i2c1_pins {
++              pinctrl-single,pins = <
++                      0x15c (PIN_INPUT_PULLUP | MUX_MODE2)    /* i2c1 */
++                      0x158 (PIN_INPUT_PULLUP | MUX_MODE2)    /* i2c1 */
++              >;
++      };
++};
++
++&uart1 {
++      pinctrl-names = "default","sleep";
++      pinctrl-0 = <&uart1_pins_default &bt_pins_default>;
++      pinctrl-1 = <&uart1_pins_sleep &bt_pins_sleep>;
++      status = "okay";
++};
++
++&i2c1 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&i2c1_pins>;
++
++      status = "okay";
++      clock-frequency = <400000>;
++
++      tps1: tps@24 {
++              reg = <0x24>;
++      };
++};
++
++&mmc2 {
++      status = "okay";
++      vmmc-supply = <&wlan_en_reg>;
++      bus-width = <4>;
++      pinctrl-names = "default", "sleep";
++      pinctrl-0 = <&mmc2_pins &wlan_pins_default>;
++      pinctrl-1 = <&mmc2_pins_sleep &wlan_pins_sleep>;
++      ti,non-removable;
++      ti,needs-special-hs-handling;
++      cap-power-off-card;
++      keep-power-in-suspend;
++
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio0>;
++              interrupts = <7 IRQ_TYPE_EDGE_RISING>;
++      };
++};
+diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
+index 369f34d..b40d168 100644
+--- a/arch/arm/boot/dts/am335x-boneblack.dts
++++ b/arch/arm/boot/dts/am335x-boneblack.dts
+@@ -147,3 +147,6 @@
+               clock-names = "mclk";
+       };
+ };
++
++/* Overlay the wilink8 based cape support */
++#include "am335x-bone-e14-wl1837.dtsi"
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-su-wl1837-audio-cape-s.patch b/patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-su-wl1837-audio-cape-s.patch
new file mode 100644 (file)
index 0000000..219c1d4
--- /dev/null
@@ -0,0 +1,301 @@
+From c60c7e3ff205a813dfe071f6a1e8818c02eb6b3c Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 2 Nov 2015 12:27:39 +0200
+Subject: [PATCH] ARCH:arm:am335x-boneblack: add su wl1837 audio cape support
+
+* enable mmc2 used for wlan and uart1 used for bluetooth
+* configure the gpios used for wlan and bluetooth controls
+* add fixed voltage regulator used for wlan power control
+* enable i2c1 used for mfi control
+* enable audio support
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/am335x-bone-su-wl1837.dtsi |  263 ++++++++++++++++++++++++++
+ arch/arm/boot/dts/am335x-boneblack.dts       |    3 +
+ 2 files changed, 266 insertions(+)
+ create mode 100644 arch/arm/boot/dts/am335x-bone-su-wl1837.dtsi
+
+diff --git a/arch/arm/boot/dts/am335x-bone-su-wl1837.dtsi b/arch/arm/boot/dts/am335x-bone-su-wl1837.dtsi
+new file mode 100644
+index 0000000..40cee07
+--- /dev/null
++++ b/arch/arm/boot/dts/am335x-bone-su-wl1837.dtsi
+@@ -0,0 +1,263 @@
++/*
++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <dt-bindings/interrupt-controller/irq.h>
++
++/ {
++      model = "TI AM335x BeagleBone Black";
++      compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
++
++      wlan_en_reg: fixedregulator@1 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++              gpio = <&gpio0 26 0>;
++              enable-active-high;
++      };
++
++      audio {
++              compatible = "sue,am33xx-generic-audio";
++              pinctrl-names = "default";
++              pinctrl-0 = <&audio_pins>;
++              sue,card-name = "Stream Audio";
++              /*sue,early-mclk;*/
++              clocks = <&si5351a 0>, <&si5351a 0>; /* playback clk, receive clk */
++              sue,persistent-clocks;
++
++              links {
++                      link@0 {
++                              sue,name = "analog";
++                              sue,stream-name = "I2S";
++
++                              sue,platform = <&mcasp0>;
++                              sue,cpu-dai-name = "48038000.mcasp";
++                              sue,codec = <&pcm_dummy>;
++                              sue,codec-dai-name = "Dummy PCM Codec";
++                      };
++              };
++      };
++
++      /* 25MHz output from quartz next to SI5351a */
++      ref25: ref25M {
++              compatible = "fixed-clock";
++              #clock-cells = <0>;
++              clock-frequency = <25000000>;
++      };
++
++      /* dummy pcm codec */
++      pcm_dummy: pcm_dummy {
++              compatible = "sue,pcm_dummy";
++              mute-gpio = <&gpio0 22 0>;
++      };
++
++      supersync {
++              compatible = "supersync";
++
++              /* TODO: Add input-timer device tree binding inside kernel */
++              /* input-timer = <&timer4>; */
++              clocks = <&si5351a 0>;
++
++              pinctrl-names = "default";
++              pinctrl-0 = <&supersync_pins>;
++
++              status="okay";
++      };
++};
++
++&am33xx_pinmux {
++      pinctrl-names = "default", "sleep";
++      pinctrl-0 = <&wlan_pins_default>;
++      pinctrl-1 = <&wlan_pins_sleep>;
++
++      uart1_pins_default: pinmux_uart1_pins_default {
++              pinctrl-single,pins = <
++                      0x180 ( PIN_INPUT  | MUX_MODE0 ) /* (D16) uart1_rxd.uart1_rxd */
++                      0x184 ( PIN_OUTPUT | MUX_MODE0 ) /* (D15) uart1_txd.uart1_txd */
++              >;
++      };
++
++      uart1_pins_sleep: pinmux_uart1_pins_sleep {
++              pinctrl-single,pins = <
++                      0x180 ( PIN_INPUT  | MUX_MODE0 ) /* (D16) uart1_rxd.uart1_rxd */
++                      0x184 ( PIN_OUTPUT | MUX_MODE0 ) /* (D15) uart1_txd.uart1_txd */
++              >;
++      };
++
++      mmc2_pins_default: pinmux_mmc2_pins_default {
++              pinctrl-single,pins = <
++                      0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
++                      0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
++                      0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
++                      0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
++                      0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
++                      0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
++              >;
++      };
++
++      mmc2_pins_sleep: pinmux_mmc2_pins_sleep {
++              pinctrl-single,pins = <
++                      0x80 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn1.mmc1_clk */
++                      0x84 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn2.mmc1_cmd */
++                      0x00 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad0.mmc1_dat0 */
++                      0x04 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad1.mmc1_dat1 */
++                      0x08 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad2.mmc1_dat2 */
++                      0x0c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad3.mmc1_dat3 */
++              >;
++      };
++
++      wlan_pins_default: pinmux_wlan_pins_default {
++              pinctrl-single,pins = <
++                      0x28 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* gpmc_ad10.gpio0_26 WL_EN*/
++                      0x2C (PIN_INPUT_PULLUP | MUX_MODE7)     /* gpmc_ad11.gpio0_27 WL_IRQ*/
++                      0x30 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* gpmc_ad12.gpio1_12 BT_EN*/
++                      0x7C  (PIN_OUTPUT_PULLUP   | MUX_MODE0) /* gpmc_csn0.gpio1_29 Cape_Buffer_EN*/
++                      0x90  (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2  Audio_sync*/
++              >;
++      };
++
++      wlan_pins_sleep: pinmux_wlan_pins_sleep {
++              pinctrl-single,pins = <
++                      0x28 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpmc_ad10.gpio0_26 WL_EN*/
++                      0x2C (PIN_INPUT_PULLUP | MUX_MODE7)     /* gpmc_ad11.gpio0_27 WL_IRQ*/
++                      0x30 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpmc_ad12.gpio1_12 BT_EN*/
++                      0x7C  (PIN_OUTPUT_PULLUP   | MUX_MODE0) /* gpmc_csn0.gpio1_29 Cape_Buffer_EN*/
++                      0x90  (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2  Audio_sync*/
++              >;
++      };
++
++      i2c1_pins: pinmux_i2c1_pins {
++              pinctrl-single,pins = <
++                      0x15c (PIN_INPUT_PULLUP | MUX_MODE2)    /* i2c1 */
++                      0x158 (PIN_INPUT_PULLUP | MUX_MODE2)    /* i2c1 */
++              >;
++      };
++
++      i2c2_pins: pinmux_i2c2_pins {
++              pinctrl-single,pins = <
++                      0x178 (PIN_INPUT_PULLUP | MUX_MODE3)    /* uart1_ctsn.i2c2_sda */
++                      0x17c (PIN_INPUT_PULLUP | MUX_MODE3)    /* uart1_rtsn.i2c2_scl */
++              >;
++      };
++
++      audio_pins: pinmux_audio_pins {
++              pinctrl-single,pins = < /*  pin-name     -> function      (S800 name) */
++                      0x6c (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* conf_gpmc_a11.gpio1_27 HDMI clock disable node */
++                      0x9c (PIN_INPUT | MUX_MODE7)            /* conf_gpmc_ben0_cle.gpio2_5 needs to be disabled */
++                      0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* GMII1_COL -> MCASP1_AXR2      (SPDIF_OUT)     - out */
++                      0x190 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* MCASP0_ACLKX -> MCASP0_ACLKX         (I2S_BCLK_OUT) - out */
++                      0x194 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* MCASP0_FSX -> MCASP0_FSX             (I2S_WCLK_OUT) - out */
++                      0x198 (PIN_INPUT | MUX_MODE0)           /* MCASP0_AXR0 -> MCASP0_AXR0           (I2S_DATA_IN) - in */
++                      0x19c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* MCASP0_AHCLKR -> MCASP0_AXR2 (I2S_DATA_OUT) -out */
++                      0x1a8 (PIN_INPUT | MUX_MODE7)           /* MCASP0_AXR1 -> GPIO3_20 */
++                      0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE0)  /* MCASP0_AHCLKX -> MCASP0_AHCLKX       (I2S_MCLK_OUT)- in */
++              >;
++      };
++
++      supersync_pins: supersync_pins {
++              pinctrl-single,pins = <
++                      0x1b4 (PIN_INPUT | MUX_MODE2)   /* xdma_event_intr1.tclkin */
++                      0x90 (PIN_OUTPUT | MUX_MODE2)   /* gpmc_advn_ale.timer4 */
++                      0x44 (PIN_OUTPUT | MUX_MODE7)   /* gpmc_a1.GPIO1_17 */
++              >;
++      };
++};
++
++&uart1 {
++      pinctrl-names = "default","sleep";
++      pinctrl-0 = <&uart1_pins_default>;
++      pinctrl-1 = <&uart1_pins_sleep>;
++      status = "okay";
++};
++
++&i2c1 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&i2c1_pins>;
++
++      status = "okay";
++      clock-frequency = <400000>;
++
++      tps1: tps@24 {
++              reg = <0x24>;
++      };
++};
++
++&i2c2 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&i2c2_pins>;
++
++      status = "okay";
++      clock-frequency = <100000>;
++
++      /* Si5351a i2c clock generator */
++      si5351a: clock-generator@60 {
++              compatible = "silabs,si5351a-msop";
++              reg = <0x60>;
++              #address-cells = <1>;
++              #size-cells = <0>;
++              #clock-cells = <1>;
++
++              /* connect xtal input to 25MHz reference */
++              clocks = <&ref25>;
++              clock-names = "xtal";
++
++              /* connect xtal input as source of pll0 and pll1 */
++              silabs,pll-source = <0 0>, <1 0>;
++
++              /*
++               * overwrite clkout0 configuration with:
++               * - 8mA output drive strength
++               * - pll0 as clock source of multisynth0
++               * - multisynth0 as clock source of output divider
++               * - multisynth0 can change pll0
++               */
++              clkout0 {
++                      reg = <0>;
++                      silabs,drive-strength = <8>;
++                      silabs,multisynth-source = <0>;
++                      silabs,clock-source = <0>;
++                      silabs,pll-master;
++              };
++      };
++};
++
++
++&mcasp0 {
++      status = "okay";
++      op-mode = <0>;          /* MCASP_IIS_MODE */
++      tdm-slots = <2>;        /*I2S = 2 channles, other: TDM */
++      num-serializer = <4>;   /*num of serializers*/
++      serial-dir = <  2 0 1 0 >; /* 0: INACTIVE, 1: TX, 2: RX */
++      tx-num-evt = <2>;       /*tx FIFO buffer lenght */
++      rx-num-evt = <1>;       /*rx FIFO buffer lenght */
++};
++
++&mmc2 {
++      status = "okay";
++      vmmc-supply = <&wlan_en_reg>;
++      bus-width = <4>;
++      pinctrl-names = "default", "sleep";
++      pinctrl-0 = <&mmc2_pins_default>;
++      pinctrl-1 = <&mmc2_pins_sleep>;
++      ti,non-removable;
++      ti,needs-special-hs-handling;
++      cap-power-off-card;
++      keep-power-in-suspend;
++
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio0>;
++              interrupts = <27 IRQ_TYPE_EDGE_RISING>;
++      };
++};
++
++&timer4 {
++      ti,timer-alwon;
++};
+diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
+index 369f34d..cf703bb 100644
+--- a/arch/arm/boot/dts/am335x-boneblack.dts
++++ b/arch/arm/boot/dts/am335x-boneblack.dts
+@@ -147,3 +147,6 @@
+               clock-names = "mclk";
+       };
+ };
++
++/* Overlay the wilink8 based cape support */
++#include "am335x-bone-su-wl1837.dtsi"
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-wl1835-cape-support.patch b/patches/kernel_patches/beaglebone-wilink8-capes/0001-ARCH-arm-am335x-boneblack-add-wl1835-cape-support.patch
new file mode 100644 (file)
index 0000000..3a20eee
--- /dev/null
@@ -0,0 +1,164 @@
+From 497cd2f737cd3454705bd62cee0649c6b3000358 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 2 Nov 2015 12:05:46 +0200
+Subject: [PATCH] ARCH:arm:am335x-boneblack: add wl1835 cape support
+
+* enable mmc2 used for wlan and uart4 used for bluetooth
+* configure the gpios used for wlan and bluetooth controls
+* add fixed voltage regulator used for wlan power control
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/am335x-bone-bb-wl1835.dtsi |  128 ++++++++++++++++++++++++++
+ arch/arm/boot/dts/am335x-boneblack.dts       |    3 +
+ 2 files changed, 131 insertions(+)
+ create mode 100644 arch/arm/boot/dts/am335x-bone-bb-wl1835.dtsi
+
+diff --git a/arch/arm/boot/dts/am335x-bone-bb-wl1835.dtsi b/arch/arm/boot/dts/am335x-bone-bb-wl1835.dtsi
+new file mode 100644
+index 0000000..501151b
+--- /dev/null
++++ b/arch/arm/boot/dts/am335x-bone-bb-wl1835.dtsi
+@@ -0,0 +1,128 @@
++/*
++ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <dt-bindings/interrupt-controller/irq.h>
++
++/ {
++      model = "TI AM335x BeagleBone Black";
++      compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
++
++      wlan_en_reg: fixedregulator@1 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++              gpio = <&gpio0 26 0>;
++              enable-active-high;
++      };
++
++      kim {
++              compatible = "kim";
++              nshutdown_gpio = <44>; /* Bank1, pin12 */
++              dev_name = "/dev/ttyO4";
++              flow_cntrl = <1>;
++              baud_rate = <3000000>;
++      };
++
++      btwilink {
++              compatible = "btwilink";
++      };
++};
++
++&am33xx_pinmux {
++      pinctrl-names = "default", "sleep";
++      pinctrl-0 = <&wlan_pins_default>;
++      pinctrl-1 = <&wlan_pins_sleep>;
++
++      uart4_pins_default: pinmux_uart4_pins_default {
++              pinctrl-single,pins = <
++                      0xD0 (PIN_INPUT | MUX_MODE6)            /* lcd_data12.uart4_cts */
++                      0xD4 (PIN_OUTPUT_PULLDOWN | MUX_MODE6)  /* lcd_data13.uart4_rts */
++                      0x70 (PIN_INPUT_PULLUP | MUX_MODE6)     /* gpmc_wait0.uart4_rxd */
++                      0x74 (PIN_OUTPUT_PULLDOWN | MUX_MODE6)  /* gpmc_wpn.uart4_txd */
++              >;
++      };
++
++      uart4_pins_sleep: pinmux_uart4_pins_sleep {
++              pinctrl-single,pins = <
++                      0xD0 (PIN_INPUT_PULLDOWN | MUX_MODE7)   /* lcd_data12.uart4_cts */
++                      0xD4 (PIN_INPUT_PULLDOWN | MUX_MODE7)   /* lcd_data13.uart4_rts */
++                      0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7)   /* gpmc_wait0.uart4_rxd */
++                      0x74 (PIN_INPUT_PULLDOWN | MUX_MODE7)   /* gpmc_wpn.uart4_txd */
++              >;
++      };
++
++      mmc2_pins_default: pinmux_mmc2_pins_default {
++              pinctrl-single,pins = <
++                      0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
++                      0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
++                      0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
++                      0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
++                      0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
++                      0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
++              >;
++      };
++
++      mmc2_pins_sleep: pinmux_mmc2_pins_sleep {
++              pinctrl-single,pins = <
++                      0x80 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn1.mmc1_clk */
++                      0x84 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn2.mmc1_cmd */
++                      0x00 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad0.mmc1_dat0 */
++                      0x04 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad1.mmc1_dat1 */
++                      0x08 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad2.mmc1_dat2 */
++                      0x0c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad3.mmc1_dat3 */
++              >;
++      };
++
++      wlan_pins_default: pinmux_wlan_pins_default {
++              pinctrl-single,pins = <
++                      0x28 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* gpmc_ad10.gpio0_26 WL_EN*/
++                      0x2C (PIN_INPUT_PULLUP | MUX_MODE7)     /* gpmc_ad11.gpio0_27 WL_IRQ*/
++                      0x30 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* gpmc_ad12.gpio1_12 BT_EN*/
++                      0x7C  (PIN_OUTPUT_PULLUP   | MUX_MODE0) /* gpmc_csn0.gpio1_29 Cape_Buffer_EN*/
++              >;
++      };
++
++      wlan_pins_sleep: pinmux_wlan_pins_sleep {
++              pinctrl-single,pins = <
++                      0x28 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpmc_ad10.gpio0_26 WL_EN*/
++                      0x2C (PIN_INPUT_PULLUP | MUX_MODE7)     /* gpmc_ad11.gpio0_27 WL_IRQ*/
++                      0x30 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpmc_ad12.gpio1_12 BT_EN*/
++                      0x7C  (PIN_OUTPUT_PULLUP   | MUX_MODE0) /* gpmc_csn0.gpio1_29 Cape_Buffer_EN*/
++
++              >;
++      };
++ };
++
++&uart4 {
++      pinctrl-names = "default","sleep";
++      pinctrl-0 = <&uart4_pins_default>;
++      pinctrl-1 = <&uart4_pins_sleep>;
++      status = "okay";
++};
++
++&mmc2 {
++      status = "okay";
++      vmmc-supply = <&wlan_en_reg>;
++      bus-width = <4>;
++      pinctrl-names = "default", "sleep";
++      pinctrl-0 = <&mmc2_pins_default>;
++      pinctrl-1 = <&mmc2_pins_sleep>;
++      ti,non-removable;
++      ti,needs-special-hs-handling;
++      cap-power-off-card;
++      keep-power-in-suspend;
++
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio0>;
++              interrupts = <27 IRQ_TYPE_EDGE_RISING>;
++      };
++};
+diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
+index 369f34d..c2386f5 100644
+--- a/arch/arm/boot/dts/am335x-boneblack.dts
++++ b/arch/arm/boot/dts/am335x-boneblack.dts
+@@ -147,3 +147,6 @@
+               clock-names = "mclk";
+       };
+ };
++
++/* Overlay the wilink8 based cape support */
++#include "am335x-bone-bb-wl1835.dtsi"
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch
new file mode 100644 (file)
index 0000000..61ffcc2
--- /dev/null
@@ -0,0 +1,126 @@
+From 15082c4b7b64e0bba816a6696b7e6262c69bb58a Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 4 Mar 2015 14:08:59 +0200
+Subject: [PATCH 01/15] imx6q-sabresd: add support for wilink8 wlan and
+ bluetooth
+
+* enable uart5 used for bluetooth with wilink8 with flow control
+* configure SD2 to be used for sdio communication to wilink8 wlan
+* configure gpios used for wlan/bt enables and wlan_irq
+* setup voltage regulator used for wl8 wlan power control
+* disable SPI1 as it pins are routed to J13 for connecting to wilink8
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl-sabresd.dtsi |   56 ++++++++++++++++++++++++++++++--
+ 1 file changed, 53 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+index 372f00a..e4daafd 100644
+--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+@@ -22,6 +22,32 @@
+               reg = <0x10000000 0x40000000>;
+       };
++      wlan_en_reg: fixedregulator@2 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++
++              /* WLAN_EN GPIO for this board – Bank4, pin7 */
++              gpio = <&gpio4 7 0>;
++
++              /* WLAN card specific delay */
++              startup-delay-us = <70000>;
++              enable-active-high;
++      };
++
++        kim {
++                compatible = "kim";
++                nshutdown_gpio = <2>;  /* GPIO_2 */
++                dev_name = "/dev/ttymxc4";
++                flow_cntrl = <1>;
++                baud_rate = <3000000>;
++        };
++
++        btwilink {
++                compatible = "btwilink";
++        };
++
+       battery: max8903@0 {
+               compatible = "fsl,max8903-charger";
+               pinctrl-names = "default";
+@@ -298,6 +324,7 @@
+       pu-supply = <&pu_dummy>; /* use pu_dummy if VDDSOC share with VDDPU */
+ };
++/* the spi pins (inctrl_ecspi1_2) are used for connecting to WL8 using J13 so we disable it
+ &ecspi1 {
+       fsl,spi-num-chipselects = <1>;
+       cs-gpios = <&gpio4 9 0>;
+@@ -313,6 +340,7 @@
+               reg = <0>;
+       };
+ };
++*/
+ &fec {
+       pinctrl-names = "default";
+@@ -553,6 +581,8 @@
+                               MX6QDL_PAD_GPIO_1__WDOG2_B 0x80000000
+                               MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x1b0b0
+                               MX6QDL_PAD_SD1_CMD__GPIO1_IO18 0x80000000
++                              MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x13059 // reserve two pins wl8 gpio, this is pulled low at reset for WL_EN
++                              MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x13059 // this is for WL_IRQ which driver will configure as an input with a pull down
+                       >;
+               };
+       };
+@@ -677,6 +707,15 @@
+       status = "okay";
+ };
++&uart5 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&pinctrl_uart5_1>;
++      status = "okay";
++
++      /* enable rts/cts usage on uart5 */
++      fsl,uart-has-rtscts;
++};
++
+ &usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+@@ -692,13 +731,24 @@
+ &usdhc2 {
+       pinctrl-names = "default";
+-      pinctrl-0 = <&pinctrl_usdhc2_1>;
+-      cd-gpios = <&gpio2 2 0>;
+-      wp-gpios = <&gpio2 3 0>;
++      pinctrl-0 = <&pinctrl_usdhc2_2>;
+       no-1-8-v;
+       keep-power-in-suspend;
+       enable-sdio-wakeup;
++      vmmc-supply = <&wlan_en_reg>;
++      non-removable;    /* non-removable is not a variable, the fact it is */
++                        /* listed is all that is used by driver  */
++      cap-power-off-card;
+       status = "okay";
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wlcore";
++              reg = <2>;
++              interrupt-parent = <&gpio4>;
++              interrupts = <6 0>;
++              platform-quirks = <1>;
++      };
+ };
+ &usdhc3 {
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0002-Bluetooth-Add-tty-HCI-driver.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0002-Bluetooth-Add-tty-HCI-driver.patch
new file mode 100644 (file)
index 0000000..45bfcae
--- /dev/null
@@ -0,0 +1,603 @@
+From 89c9114717e21efc0ae53f2783ff2e65cd6d3164 Mon Sep 17 00:00:00 2001
+From: Pavan Savoy <pavan_savoy@ti.com>
+Date: Mon, 15 Oct 2012 17:47:35 -0500
+Subject: [PATCH 02/15] Bluetooth: Add tty HCI driver
+
+tty_hci driver exposes a /dev/hci_tty character device node, that intends to
+emulate a generic /dev/ttyX device that would be used by the user-space
+Bluetooth stacks to send/receive data to/from the WL combo-connectivity
+chipsets.
+
+The device driver has no internal logic of its own to intrepret data & all
+such logic is handled by the user-space stack.
+
+Change-Id: Ifa3860bbc7e252af210fde710bce14143239b552
+Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
+ [Fixed checkpatch warnings]
+Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
+ [Fixed checkpatch --strict warnings]
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/Kconfig   |    8 +
+ drivers/misc/ti-st/Makefile  |    1 +
+ drivers/misc/ti-st/tty_hci.c |  542 ++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 551 insertions(+)
+ create mode 100644 drivers/misc/ti-st/tty_hci.c
+
+diff --git a/drivers/misc/ti-st/Kconfig b/drivers/misc/ti-st/Kconfig
+index f34dcc5..f2df2c7 100644
+--- a/drivers/misc/ti-st/Kconfig
++++ b/drivers/misc/ti-st/Kconfig
+@@ -14,4 +14,12 @@ config TI_ST
+         are returned to relevant protocol drivers based on their
+         packet types.
++config ST_HCI
++      tristate "HCI TTY emulation driver for Bluetooth"
++      depends on TI_ST
++      help
++        This enables the TTY device like emulation for HCI used by
++        user-space Bluetooth stacks.
++        It will provide a character device for user space Bluetooth stack to
++        send/receive data over shared transport.
+ endmenu
+diff --git a/drivers/misc/ti-st/Makefile b/drivers/misc/ti-st/Makefile
+index 78d7ebb..4546219 100644
+--- a/drivers/misc/ti-st/Makefile
++++ b/drivers/misc/ti-st/Makefile
+@@ -4,3 +4,4 @@
+ #
+ obj-$(CONFIG_TI_ST)           += st_drv.o
+ st_drv-objs                   := st_core.o st_kim.o st_ll.o
++obj-$(CONFIG_ST_HCI)          += tty_hci.o
+diff --git a/drivers/misc/ti-st/tty_hci.c b/drivers/misc/ti-st/tty_hci.c
+new file mode 100644
+index 0000000..5b27b04
+--- /dev/null
++++ b/drivers/misc/ti-st/tty_hci.c
+@@ -0,0 +1,542 @@
++/*
++ *  TTY emulation for user-space Bluetooth stacks over HCI-H4
++ *  Copyright (C) 2011-2012 Texas Instruments
++ *  Author: Pavan Savoy <pavan_savoy@ti.com>
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License version 2 as
++ *  published by the Free Software Foundation.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ */
++
++/** define one of the following for debugging
++#define DEBUG
++#define VERBOSE
++*/
++
++#define pr_fmt(fmt) "(hci_tty): " fmt
++#include <linux/module.h>
++#include <linux/cdev.h>
++#include <linux/fs.h>
++#include <linux/device.h>
++
++#include <linux/uaccess.h>
++#include <linux/tty.h>
++#include <linux/sched.h>
++
++#include <linux/delay.h>
++#include <linux/firmware.h>
++#include <linux/platform_device.h>
++#include <linux/poll.h>
++#include <linux/skbuff.h>
++#include <linux/interrupt.h>
++
++#include <linux/ti_wilink_st.h>
++
++/* Number of seconds to wait for registration completion
++ * when ST returns PENDING status.
++ */
++#define BT_REGISTER_TIMEOUT   6000    /* 6 sec */
++
++/**
++ * struct ti_st - driver operation structure
++ * @hdev: hci device pointer which binds to bt driver
++ * @reg_status: ST registration callback status
++ * @st_write: write function provided by the ST driver
++ *    to be used by the driver during send_frame.
++ * @wait_reg_completion - completion sync between ti_st_open
++ *    and st_reg_completion_cb.
++ */
++struct ti_st {
++      struct hci_dev *hdev;
++      char reg_status;
++      long (*st_write)(struct sk_buff *);
++      struct completion wait_reg_completion;
++      wait_queue_head_t data_q;
++      struct sk_buff_head rx_list;
++};
++
++#define DEVICE_NAME     "hci_tty"
++
++/***********Functions called from ST driver**********************************/
++/* Called by Shared Transport layer when receive data is
++ * available */
++static long st_receive(void *priv_data, struct sk_buff *skb)
++{
++      struct ti_st    *hst = (void *)priv_data;
++
++      pr_debug("@ %s", __func__);
++#ifdef VERBOSE
++      print_hex_dump(KERN_INFO, ">rx>", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, skb->len, 0);
++#endif
++      skb_queue_tail(&hst->rx_list, skb);
++      wake_up_interruptible(&hst->data_q);
++      return 0;
++}
++
++/* Called by ST layer to indicate protocol registration completion
++ * status.ti_st_open() function will wait for signal from this
++ * API when st_register() function returns ST_PENDING.
++ */
++static void st_reg_completion_cb(void *priv_data, char data)
++{
++      struct ti_st    *lhst = (void *)priv_data;
++
++      pr_info("@ %s\n", __func__);
++      /* Save registration status for use in ti_st_open() */
++      lhst->reg_status = data;
++      /* complete the wait in ti_st_open() */
++      complete(&lhst->wait_reg_completion);
++}
++
++/* protocol structure registered with shared transport */
++#define MAX_BT_CHNL_IDS 3
++static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = {
++      {
++              .chnl_id = 0x04, /* HCI Events */
++              .hdr_len = 2,
++              .offset_len_in_hdr = 1,
++              .len_size = 1, /* sizeof(plen) in struct hci_event_hdr */
++              .reserve = 8,
++      },
++      {
++              .chnl_id = 0x02, /* ACL */
++              .hdr_len = 4,
++              .offset_len_in_hdr = 2,
++              .len_size = 2,  /* sizeof(dlen) in struct hci_acl_hdr */
++              .reserve = 8,
++      },
++      {
++              .chnl_id = 0x03, /* SCO */
++              .hdr_len = 3,
++              .offset_len_in_hdr = 2,
++              .len_size = 1, /* sizeof(dlen) in struct hci_sco_hdr */
++              .reserve = 8,
++      },
++};
++/** hci_tty_open Function
++ *  This function will perform an register on ST driver.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @inod  :
++ *  Returns  0 -  on success
++ *           else suitable error code
++ */
++int hci_tty_open(struct inode *inod, struct file *file)
++{
++      int i = 0, err = 0;
++      unsigned long timeleft;
++      struct ti_st *hst;
++
++      pr_info("inside %s (%p, %p)\n", __func__, inod, file);
++
++      hst = kzalloc(sizeof(*hst), GFP_KERNEL);
++      file->private_data = hst;
++      hst = file->private_data;
++
++      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++              ti_st_proto[i].priv_data = hst;
++              ti_st_proto[i].max_frame_size = 1026;
++              ti_st_proto[i].recv = st_receive;
++              ti_st_proto[i].reg_complete_cb = st_reg_completion_cb;
++
++              /* Prepare wait-for-completion handler */
++              init_completion(&hst->wait_reg_completion);
++              /* Reset ST registration callback status flag,
++               * this value will be updated in
++               * st_reg_completion_cb()
++               * function whenever it called from ST driver.
++               */
++              hst->reg_status = -EINPROGRESS;
++
++              err = st_register(&ti_st_proto[i]);
++              if (!err)
++                      goto done;
++
++              if (err != -EINPROGRESS) {
++                      pr_err("st_register failed %d", err);
++                      goto error;
++              }
++
++              /* ST is busy with either protocol
++               * registration or firmware download.
++               */
++              pr_debug("waiting for registration completion signal from ST");
++              timeleft = wait_for_completion_timeout
++                      (&hst->wait_reg_completion,
++                       msecs_to_jiffies(BT_REGISTER_TIMEOUT));
++              if (!timeleft) {
++                      pr_err("Timeout(%d sec),didn't get reg completion signal from ST",
++                             BT_REGISTER_TIMEOUT / 1000);
++                      err = -ETIMEDOUT;
++                      goto error;
++              }
++
++              /* Is ST registration callback
++               * called with ERROR status? */
++              if (hst->reg_status != 0) {
++                      pr_err("ST registration completed with invalid status %d",
++                             hst->reg_status);
++                      err = -EAGAIN;
++                      goto error;
++              }
++
++done:
++              hst->st_write = ti_st_proto[i].write;
++              if (!hst->st_write) {
++                      pr_err("undefined ST write function");
++                      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++                              /* Undo registration with ST */
++                              err = st_unregister(&ti_st_proto[i]);
++                              if (err)
++                                      pr_err("st_unregister() failed with error %d",
++                                             err);
++                              hst->st_write = NULL;
++                      }
++                      return -EIO;
++              }
++      }
++
++      skb_queue_head_init(&hst->rx_list);
++      init_waitqueue_head(&hst->data_q);
++
++      return 0;
++
++error:
++      kfree(hst);
++      return err;
++}
++
++/** hci_tty_release Function
++ *  This function will un-registers from the ST driver.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @inod  :
++ *  Returns  0 -  on success
++ *           else suitable error code
++ */
++int hci_tty_release(struct inode *inod, struct file *file)
++{
++      int err, i;
++      struct ti_st *hst = file->private_data;
++
++      pr_info("inside %s (%p, %p)\n", __func__, inod, file);
++
++      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++              err = st_unregister(&ti_st_proto[i]);
++              if (err)
++                      pr_err("st_unregister(%d) failed with error %d",
++                             ti_st_proto[i].chnl_id, err);
++      }
++
++      hst->st_write = NULL;
++      skb_queue_purge(&hst->rx_list);
++      kfree(hst);
++      return err;
++}
++
++/** hci_tty_read Function
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @data  : Data which needs to be passed to APP
++ *  @size  : Length of the data passesd
++ *  offset :
++ *  Returns  Size of packet received -  on success
++ *           else suitable error code
++ */
++ssize_t hci_tty_read(struct file *file, char __user *data, size_t size,
++              loff_t *offset)
++{
++      int len = 0, tout;
++      struct sk_buff *skb = NULL, *rskb = NULL;
++      struct ti_st    *hst;
++
++      pr_debug("inside %s (%p, %p, %u, %p)\n",
++               __func__, file, data, size, offset);
++
++      /* Validate input parameters */
++      if ((NULL == file) || (((NULL == data) || (0 == size)))) {
++              pr_err("Invalid input params passed to %s", __func__);
++              return -EINVAL;
++      }
++
++      hst = file->private_data;
++
++      /* cannot come here if poll-ed before reading
++       * if not poll-ed wait on the same wait_q
++       */
++      tout = wait_event_interruptible_timeout(hst->data_q,
++                      !skb_queue_empty(&hst->rx_list),
++                              msecs_to_jiffies(1000));
++      /* Check for timed out condition */
++      if (0 == tout) {
++              pr_err("Device Read timed out\n");
++              return -ETIMEDOUT;
++      }
++
++      /* hst->rx_list not empty skb already present */
++      skb = skb_dequeue(&hst->rx_list);
++      if (!skb) {
++              pr_err("dequed skb is null?\n");
++              return -EIO;
++      }
++
++#ifdef VERBOSE
++      print_hex_dump(KERN_INFO, ">in>", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, skb->len, 0);
++#endif
++
++      /* Forward the data to the user */
++      if (skb->len >= size) {
++              pr_err("FIONREAD not done before read\n");
++              return -ENOMEM;
++      } else {
++              /* returning skb */
++              rskb = alloc_skb(size, GFP_KERNEL);
++              if (!rskb) {
++                      pr_err("alloc_skb error\n");
++                      return -ENOMEM;
++              }
++
++              /* cb[0] has the pkt_type 0x04 or 0x02 or 0x03 */
++              memcpy(skb_put(rskb, 1), &skb->cb[0], 1);
++              memcpy(skb_put(rskb, skb->len), skb->data, skb->len);
++
++              if (copy_to_user(data, rskb->data, rskb->len)) {
++                      pr_err("unable to copy to user space\n");
++                      /* Queue the skb back to head */
++                      skb_queue_head(&hst->rx_list, skb);
++                      kfree_skb(rskb);
++                      return -EIO;
++              }
++      }
++
++      len = rskb->len;        /* len of returning skb */
++      kfree_skb(skb);
++      kfree_skb(rskb);
++      pr_debug("total size read= %d\n", len);
++      return len;
++}
++
++/* hci_tty_write Function
++ *
++ *  Parameters :
++ *  @file   : File pointer for BT char driver
++ *  @data   : packet data from BT application
++ *  @size   : Size of the packet data
++ *  @offset :
++ *  Returns  Size of packet on success
++ *           else suitable error code
++ */
++ssize_t hci_tty_write(struct file *file, const char __user *data,
++              size_t size, loff_t *offset)
++{
++      struct ti_st *hst = file->private_data;
++      struct  sk_buff *skb;
++
++      pr_debug("inside %s (%p, %p, %u, %p)\n",
++               __func__, file, data, size, offset);
++
++      if (!hst->st_write) {
++              pr_err(" Can't write to ST, hhci_tty->st_write null ?");
++              return -EINVAL;
++      }
++
++      skb = alloc_skb(size, GFP_KERNEL);
++      /* Validate Created SKB */
++      if (NULL == skb) {
++              pr_err("Error aaloacting SKB");
++              return -ENOMEM;
++      }
++
++      /* Forward the data from the user space to ST core */
++      if (copy_from_user(skb_put(skb, size), data, size)) {
++              pr_err(" Unable to copy from user space");
++              kfree_skb(skb);
++              return -EIO;
++      }
++
++#ifdef VERBOSE
++      pr_debug("start data..");
++      print_hex_dump(KERN_INFO, "<out<", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, size, 0);
++      pr_debug("\n..end data");
++#endif
++
++      hst->st_write(skb);
++      return size;
++}
++
++/** hci_tty_ioctl Function
++ *  This will peform the functions as directed by the command and command
++ *  argument.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @cmd   : IOCTL Command
++ *  @arg   : Command argument for IOCTL command
++ *  Returns  0 on success
++ *           else suitable error code
++ */
++static long hci_tty_ioctl(struct file *file,
++              unsigned int cmd, unsigned long arg)
++{
++      struct sk_buff *skb = NULL;
++      int             retcode = 0;
++      struct ti_st    *hst;
++
++      pr_debug("inside %s (%p, %u, %lx)", __func__, file, cmd, arg);
++
++      /* Validate input parameters */
++      if ((NULL == file) || (0 == cmd)) {
++              pr_err("invalid input parameters passed to %s", __func__);
++              return -EINVAL;
++      }
++
++      hst = file->private_data;
++
++      switch (cmd) {
++      case FIONREAD:
++              /* Deque the SKB from the head if rx_list is not empty
++               * update the argument with skb->len to provide amount of data
++               * available in the available SKB +1 for the PKT_TYPE
++               * field not provided in data by TI-ST.
++               */
++              skb = skb_dequeue(&hst->rx_list);
++              if (skb != NULL) {
++                      *(unsigned int *)arg = skb->len + 1;
++                      /* Re-Store the SKB for furtur Read operations */
++                      skb_queue_head(&hst->rx_list, skb);
++              } else {
++                      *(unsigned int *)arg = 0;
++              }
++              pr_debug("returning %d\n", *(unsigned int *)arg);
++              break;
++      default:
++              pr_debug("Un-Identified IOCTL %d", cmd);
++              retcode = 0;
++              break;
++      }
++
++      return retcode;
++}
++
++/** hci_tty_poll Function
++ *  This function will wait till some data is received to the hci_tty driver from ST
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @wait  : POLL wait information
++ *  Returns  status of POLL on success
++ *           else suitable error code
++ */
++static unsigned int hci_tty_poll(struct file *file, poll_table *wait)
++{
++      struct ti_st    *hst = file->private_data;
++      unsigned long mask = 0;
++
++      pr_debug("@ %s\n", __func__);
++
++      /* wait to be completed by st_receive */
++      poll_wait(file, &hst->data_q, wait);
++      pr_debug("poll broke\n");
++
++      if (!skb_queue_empty(&hst->rx_list)) {
++              pr_debug("rx list que !empty\n");
++              mask |= POLLIN; /* TODO: check app for mask */
++      }
++
++      return mask;
++}
++
++/* BT Char driver function pointers
++ * These functions are called from USER space by pefroming File Operations
++ * on /dev/hci_tty node exposed by this driver during init
++ */
++const struct file_operations hci_tty_chrdev_ops = {
++      .owner = THIS_MODULE,
++      .open = hci_tty_open,
++      .read = hci_tty_read,
++      .write = hci_tty_write,
++      .unlocked_ioctl = hci_tty_ioctl,
++      .poll = hci_tty_poll,
++      .release = hci_tty_release,
++};
++
++/*********Functions called during insmod and delmod****************************/
++
++static int hci_tty_major;             /* major number */
++static struct class *hci_tty_class;   /* class during class_create */
++static struct device *hci_tty_dev;    /* dev during device_create */
++/** hci_tty_init Function
++ *  This function Initializes the hci_tty driver parametes and exposes
++ *  /dev/hci_tty node to user space
++ *
++ *  Parameters : NULL
++ *  Returns  0 on success
++ *           else suitable error code
++ */
++static int __init hci_tty_init(void)
++{
++      pr_info("inside %s\n", __func__);
++
++      /* Expose the device DEVICE_NAME to user space
++       * And obtain the major number for the device
++       */
++      hci_tty_major = register_chrdev(0, DEVICE_NAME, &hci_tty_chrdev_ops);
++
++      if (0 > hci_tty_major) {
++              pr_err("Error when registering to char dev");
++              return hci_tty_major;
++      }
++
++      /*  udev */
++      hci_tty_class = class_create(THIS_MODULE, DEVICE_NAME);
++      if (IS_ERR(hci_tty_class)) {
++              pr_err("Something went wrong in class_create");
++              unregister_chrdev(hci_tty_major, DEVICE_NAME);
++              return -1;
++      }
++
++      hci_tty_dev =
++              device_create(hci_tty_class, NULL, MKDEV(hci_tty_major, 0),
++                            NULL, DEVICE_NAME);
++      if (IS_ERR(hci_tty_dev)) {
++              pr_err("Error in device create");
++              unregister_chrdev(hci_tty_major, DEVICE_NAME);
++              class_destroy(hci_tty_class);
++              return -1;
++      }
++      pr_info("allocated %d, %d\n", hci_tty_major, 0);
++      return 0;
++}
++
++/** hci_tty_exit Function
++ *  This function Destroys the hci_tty driver parametes and /dev/hci_tty node
++ *
++ *  Parameters : NULL
++ *  Returns   NULL
++ */
++static void __exit hci_tty_exit(void)
++{
++      pr_info("inside %s\n", __func__);
++      pr_info("bye.. freeing up %d\n", hci_tty_major);
++
++      device_destroy(hci_tty_class, MKDEV(hci_tty_major, 0));
++      class_destroy(hci_tty_class);
++      unregister_chrdev(hci_tty_major, DEVICE_NAME);
++}
++
++module_init(hci_tty_init);
++module_exit(hci_tty_exit);
++
++MODULE_AUTHOR("Pavan Savoy <pavan_savoy@ti.com>");
++MODULE_LICENSE("GPL");
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch
new file mode 100644 (file)
index 0000000..779c427
--- /dev/null
@@ -0,0 +1,84 @@
+From daaf43518c6ae486b5404c0dd35568c67687d6cc Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 4 Mar 2015 14:13:15 +0200
+Subject: [PATCH 03/15] imx_v7_defconfig: enable Wilink8 related switches
+
+* Disable internal mac80211 and cfg80211 as we are building wilink8
+  drivers using backport and loading as modules
+* enable wlan and hci related switches
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/configs/imx_v7_defconfig |   37 +++++++++++++++++++++++++++++++------
+ 1 file changed, 31 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
+index d71f731..64e265d 100644
+--- a/arch/arm/configs/imx_v7_defconfig
++++ b/arch/arm/configs/imx_v7_defconfig
+@@ -66,9 +66,8 @@ CONFIG_LLC2=y
+ CONFIG_CAN=y
+ CONFIG_CAN_FLEXCAN=y
+ CONFIG_CAN_M_CAN=y
+-CONFIG_CFG80211=y
+-CONFIG_CFG80211_WEXT=y
+-CONFIG_MAC80211=y
++# CONFIG_CFG80211 is not set
++# CONFIG_MAC80211 is not set
+ CONFIG_BT=y
+ CONFIG_BT_RFCOMM=y
+@@ -77,7 +76,7 @@ CONFIG_BT_BNEP=y
+ CONFIG_BT_BNEP_MC_FILTER=y
+ CONFIG_BT_BNEP_PROTO_FILTER=y
+ CONFIG_BT_HIDP=y
+-
++CONFIG_BT_WILINK=y
+ #
+ # Bluetooth device drivers
+ #
+@@ -87,7 +86,7 @@ CONFIG_BT_HCIUART=y
+ CONFIG_BT_HCIUART_H4=y
+ CONFIG_BT_HCIUART_BCSP=y
+ CONFIG_BT_HCIUART_ATH3K=y
+-# CONFIG_BT_HCIUART_LL is not set
++CONFIG_BT_HCIUART_LL=y
+ # CONFIG_BT_HCIUART_3WIRE is not set
+ CONFIG_BT_HCIBCM203X=y
+ # CONFIG_BT_HCIBPA10X is not set
+@@ -400,5 +399,31 @@ CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=y
+ CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y
+ CONFIG_CRC_CCITT=m
+ CONFIG_CRC_T10DIF=y
+-CONFIG_CRC7=m
++CONFIG_CRC7=y
+ CONFIG_LIBCRC32C=m
++#TI add for WL8
++CONFIG_WLAN=y
++CONFIG_CRYPTO_ARC4=y
++CONFIG_CRYPTO_AES=y
++CONFIG_NETFILTER=y
++CONFIG_NETFILTER_ADVANCED=y
++CONFIG_NF_CONNTRACK=y
++CONFIG_NETFILTER_XTABLES=y
++CONFIG_NF_DEFRAG_IPV4=y
++CONFIG_NF_CONNTRACK_IPV4=y
++CONFIG_NF_CONNTRACK_PROC_COMPAT=y
++CONFIG_IP_NF_IPTABLES=y
++CONFIG_IP_NF_FILTER=y
++CONFIG_IP_NF_TARGET_LOG=y
++CONFIG_NF_NAT=y
++CONFIG_NF_NAT_NEEDED=y
++CONFIG_IP_NF_TARGET_MASQUERADE=y
++CONFIG_INPUT_UINPUT=y
++CONFIG_AVERAGE=y
++CONFIG_PROC_DEVICETREE=y
++# enable dynamic debug for wl8
++CONFIG_DYNAMIC_DEBUG=y
++#enable ti shared transport support support
++CONFIG_TI_ST=y
++CONFIG_ST_HCI=y
++
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch
new file mode 100644 (file)
index 0000000..f61bd63
--- /dev/null
@@ -0,0 +1,37 @@
+From fb03dbd35bce057284d7b20c41798026cc054e7a Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 29 Jan 2014 09:24:06 +0200
+Subject: [PATCH 04/15] st_kim: do not use debugfs functions if not enabled
+
+the probe function was using debugfs apis without checking if
+CONFIG_DEBUG_FS was enabled resulting with runtime errors.
+Fix this so these apis will only be used if the switch is active.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index 83269f1..fbf4dfd 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -778,6 +778,7 @@ static int kim_probe(struct platform_device *pdev)
+       kim_gdata->baud_rate = pdata->baud_rate;
+       pr_info("sysfs entries created\n");
++#ifdef CONFIG_DEBUG_FS
+       kim_debugfs_dir = debugfs_create_dir("ti-st", NULL);
+       if (IS_ERR(kim_debugfs_dir)) {
+               pr_err(" debugfs entries creation failed ");
+@@ -794,6 +795,7 @@ static int kim_probe(struct platform_device *pdev)
+ err_debugfs_dir:
+       sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
++#endif
+ err_sysfs_group:
+       st_core_exit(kim_gdata->core_data);
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch
new file mode 100644 (file)
index 0000000..abe2c0b
--- /dev/null
@@ -0,0 +1,39 @@
+From 9cf993211bca3ec32b84617a6b6ced2b02db9e67 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 29 Jan 2014 09:03:41 +0200
+Subject: [PATCH 05/15] st_kim: allow suspend if callback is not registered
+
+Suspend/resume was failing if callbacks were not registered.
+As it is ok not to do anything when suspending fix this
+so it soen't return an error and allow the system to suspend.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index fbf4dfd..dbd22e3 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -839,7 +839,7 @@ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+       if (pdata->suspend)
+               return pdata->suspend(pdev, state);
+-      return -EOPNOTSUPP;
++      return 0;
+ }
+ static int kim_resume(struct platform_device *pdev)
+@@ -849,7 +849,7 @@ static int kim_resume(struct platform_device *pdev)
+       if (pdata->resume)
+               return pdata->resume(pdev);
+-      return -EOPNOTSUPP;
++      return 0;
+ }
+ /**********************************************************************/
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0006-btwilink-add-minimal-device-tree-support.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0006-btwilink-add-minimal-device-tree-support.patch
new file mode 100644 (file)
index 0000000..01a9f47
--- /dev/null
@@ -0,0 +1,53 @@
+From 34e06b0cfcd4abb96d686dcc6af0bdcdd153cc28 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 23 May 2013 17:15:21 +0300
+Subject: [PATCH 06/15] btwilink: add minimal device tree support
+
+Add minimal device tree support to the btwilink driver that is used
+for binding bluetooth with the ti-st shared transport driver.
+
+Change-Id: I301c49d29046f20f8868bebb14347e82c12c8140
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: bvijay <bvijay@ti.com>
+---
+ drivers/bluetooth/btwilink.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
+index 60abf59..12595c9 100644
+--- a/drivers/bluetooth/btwilink.c
++++ b/drivers/bluetooth/btwilink.c
+@@ -30,6 +30,7 @@
+ #include <linux/ti_wilink_st.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ /* Bluetooth Driver Version */
+ #define VERSION               "1.0"
+@@ -291,6 +292,14 @@ static int ti_st_send_frame(struct sk_buff *skb)
+       return 0;
+ }
++static const struct of_device_id btwilink_of_match[] = {
++{
++      .compatible = "btwilink",
++      },
++      {}
++};
++MODULE_DEVICE_TABLE(of, btwilink_of_match);
++
+ static int bt_ti_probe(struct platform_device *pdev)
+ {
+       static struct ti_st *hst;
+@@ -355,6 +364,7 @@ static struct platform_driver btwilink_driver = {
+       .driver = {
+               .name = "btwilink",
+               .owner = THIS_MODULE,
++              .of_match_table = of_match_ptr(btwilink_of_match),
+       },
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0007-ti-st-add-device-tree-support.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0007-ti-st-add-device-tree-support.patch
new file mode 100644 (file)
index 0000000..daa1f04
--- /dev/null
@@ -0,0 +1,256 @@
+From dc0ee4e50236af5acae1583d643354d278a91a1f Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 23 May 2013 17:11:14 +0300
+Subject: [PATCH 07/15] ti-st: add device tree support
+
+When using device tree, driver configuration data need to be read from
+device node.
+Add support for getting the platform data information from the device
+tree information stored in the .dtb file in case it exists.
+
+Change-Id: I74f7f869fc257a057edb9f35c5fd8cbafb810164
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: bvijay <bvijay@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c  |   96 ++++++++++++++++++++++++++++++++++++++----
+ drivers/misc/ti-st/st_ll.c   |   17 +++++++-
+ include/linux/ti_wilink_st.h |    1 +
+ 3 files changed, 104 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index dbd22e3..8cb48b1 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -36,7 +36,8 @@
+ #include <linux/skbuff.h>
+ #include <linux/ti_wilink_st.h>
+ #include <linux/module.h>
+-
++#include <linux/of.h>
++#include <linux/of_device.h>
+ #define MAX_ST_DEVICES        3       /* Imagine 1 on each UART for now */
+ static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
+@@ -44,6 +45,9 @@ static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
+ /**********************************************************************/
+ /* internal functions */
++struct ti_st_plat_data        *dt_pdata;
++static struct ti_st_plat_data *get_platform_data(struct device *dev);
++
+ /**
+  * st_get_plat_device -
+  *    function which returns the reference to the platform device
+@@ -461,7 +465,12 @@ long st_kim_start(void *kim_data)
+       struct kim_data_s       *kim_gdata = (struct kim_data_s *)kim_data;
+       pr_info(" %s", __func__);
+-      pdata = kim_gdata->kim_pdev->dev.platform_data;
++      if (kim_gdata->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_gdata->kim_pdev->dev.platform_data;
++      }
+       do {
+               /* platform specific enabling code here */
+@@ -521,12 +530,18 @@ long st_kim_stop(void *kim_data)
+ {
+       long err = 0;
+       struct kim_data_s       *kim_gdata = (struct kim_data_s *)kim_data;
+-      struct ti_st_plat_data  *pdata =
+-              kim_gdata->kim_pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       struct tty_struct       *tty = kim_gdata->core_data->tty;
+       INIT_COMPLETION(kim_gdata->ldisc_installed);
++      if (kim_gdata->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else
++              pdata = kim_gdata->kim_pdev->dev.platform_data;
++
++
+       if (tty) {      /* can be called before ldisc is installed */
+               /* Flush any pending characters in the driver and discipline. */
+               tty_ldisc_flush(tty);
+@@ -715,13 +730,53 @@ static const struct file_operations list_debugfs_fops = {
+  * board-*.c file
+  */
++static const struct of_device_id kim_of_match[] = {
++{
++      .compatible = "kim",
++      },
++      {}
++};
++MODULE_DEVICE_TABLE(of, kim_of_match);
++
++static struct ti_st_plat_data *get_platform_data(struct device *dev)
++{
++      struct device_node *np = dev->of_node;
++      const u32 *dt_property;
++      int len;
++
++      dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
++
++      if (!dt_pdata)
++              pr_err("Can't allocate device_tree platform data\n");
++
++      dt_property = of_get_property(np, "dev_name", &len);
++      if (dt_property)
++              memcpy(&dt_pdata->dev_name, dt_property, len);
++      of_property_read_u32(np, "nshutdown_gpio",
++                           (u32 *)&dt_pdata->nshutdown_gpio);
++      of_property_read_u32(np, "flow_cntrl", (u32 *)&dt_pdata->flow_cntrl);
++      of_property_read_u32(np, "baud_rate", (u32 *)&dt_pdata->baud_rate);
++
++      return dt_pdata;
++}
++
+ static struct dentry *kim_debugfs_dir;
+ static int kim_probe(struct platform_device *pdev)
+ {
+       struct kim_data_s       *kim_gdata;
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       int err;
++      if (pdev->dev.of_node)
++              pdata = get_platform_data(&pdev->dev);
++      else
++              pdata = pdev->dev.platform_data;
++
++      if (pdata == NULL) {
++              dev_err(&pdev->dev, "Platform Data is missing\n");
++              return -ENXIO;
++      }
++
+       if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
+               /* multiple devices could exist */
+               st_kim_devices[pdev->id] = pdev;
+@@ -809,9 +864,16 @@ err_core_init:
+ static int kim_remove(struct platform_device *pdev)
+ {
+       /* free the GPIOs requested */
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       struct kim_data_s       *kim_gdata;
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
++
+       kim_gdata = dev_get_drvdata(&pdev->dev);
+       /* Free the Bluetooth/FM/GPIO
+@@ -829,12 +891,22 @@ static int kim_remove(struct platform_device *pdev)
+       kfree(kim_gdata);
+       kim_gdata = NULL;
++      kfree(dt_pdata);
++      dt_pdata = NULL;
++
+       return 0;
+ }
+ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+ {
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
++
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
+       if (pdata->suspend)
+               return pdata->suspend(pdev, state);
+@@ -844,7 +916,14 @@ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+ static int kim_resume(struct platform_device *pdev)
+ {
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
++
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
+       if (pdata->resume)
+               return pdata->resume(pdev);
+@@ -862,6 +941,7 @@ static struct platform_driver kim_platform_driver = {
+       .driver = {
+               .name = "kim",
+               .owner = THIS_MODULE,
++              .of_match_table = of_match_ptr(kim_of_match),
+       },
+ };
+diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
+index 93b4d67..518e1b7 100644
+--- a/drivers/misc/ti-st/st_ll.c
++++ b/drivers/misc/ti-st/st_ll.c
+@@ -26,6 +26,7 @@
+ #include <linux/ti_wilink_st.h>
+ /**********************************************************************/
++
+ /* internal functions */
+ static void send_ll_cmd(struct st_data_s *st_data,
+       unsigned char cmd)
+@@ -53,7 +54,13 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
+       /* communicate to platform about chip asleep */
+       kim_data = st_data->kim_data;
+-      pdata = kim_data->kim_pdev->dev.platform_data;
++      if (kim_data->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_data->kim_pdev->dev.platform_data;
++      }
++
+       if (pdata->chip_asleep)
+               pdata->chip_asleep(NULL);
+ }
+@@ -86,7 +93,13 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
+       /* communicate to platform about chip wakeup */
+       kim_data = st_data->kim_data;
+-      pdata = kim_data->kim_pdev->dev.platform_data;
++      if (kim_data->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_data->kim_pdev->dev.platform_data;
++      }
++
+       if (pdata->chip_awake)
+               pdata->chip_awake(NULL);
+ }
+diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
+index 932b763..39e577c 100644
+--- a/include/linux/ti_wilink_st.h
++++ b/include/linux/ti_wilink_st.h
+@@ -86,6 +86,7 @@ struct st_proto_s {
+ extern long st_register(struct st_proto_s *);
+ extern long st_unregister(struct st_proto_s *);
++extern struct ti_st_plat_data   *dt_pdata;
+ /*
+  * header information used by st_core.c
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch
new file mode 100644 (file)
index 0000000..104ef9e
--- /dev/null
@@ -0,0 +1,175 @@
+From 60896540aa4c537e75ef50194fe6d7ee2de81cca Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 23 Mar 2015 13:14:06 +0200
+Subject: [PATCH 08/15] imx6sl-evk: add support for wilink8 wlan and bluetooth
+
+* enable uart4 used for bluetooth with wilink8 with flow control
+* configure SD3 to be used for sdio communication to wilink8 wlan
+* configure gpios used for wlan/bt enables and wlan_irq
+* setup voltage regulator used for wl8 wlan power control
+* disable SD1 as it pins are used for BT/WLAN EN, IRQ, BT UART
+
+Signed-off-by: Alexey Berd <alexeyb@ti.com>
+---
+ arch/arm/boot/dts/imx6sl-evk-common.dtsi |   59 +++++++++++++++++++++---------
+ arch/arm/boot/dts/imx6sl.dtsi            |   43 ++++------------------
+ 2 files changed, 49 insertions(+), 53 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6sl-evk-common.dtsi b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+index bcef6b0..43258d5 100644
+--- a/arch/arm/boot/dts/imx6sl-evk-common.dtsi
++++ b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+@@ -11,6 +11,28 @@
+               reg = <0x80000000 0x40000000>;
+       };
++      wlan_en_reg: fixedregulator@2 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++              /* WLAN_EN GPIO for this board - Bank5, pin13 */
++              gpio = <&gpio5 13 0>;
++              enable-active-high;
++      };
++
++      kim {
++              compatible = "kim";
++              nshutdown_gpio = <134>;  // GPIO5_6 The wl8 driver expects gpio to be an integer, so gpio5_6 is (5-1)*32+6=134
++              dev_name = "/dev/ttymxc3";
++              flow_cntrl = <1>;
++              baud_rate = <3000000>;
++      };
++
++      btwilink {
++              compatible = "btwilink";
++      };
++
+       battery: max8903@0 {
+               compatible = "fsl,max8903-charger";
+               pinctrl-names = "default";
+@@ -488,6 +510,13 @@
+       status = "okay";
+ };
++&uart4 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&pinctrl_uart4_1>;
++      status = "okay";
++      fsl,uart-has-rtscts;      // enable rts/cts usage on uart4
++};
++
+ &usbotg1 {
+       vbus-supply = <&reg_usb_otg1_vbus>;
+       pinctrl-names = "default";
+@@ -504,19 +533,6 @@
+       status = "okay";
+ };
+-&usdhc1 {
+-      pinctrl-names = "default", "state_100mhz", "state_200mhz";
+-      pinctrl-0 = <&pinctrl_usdhc1_1>;
+-      pinctrl-1 = <&pinctrl_usdhc1_1_100mhz>;
+-      pinctrl-2 = <&pinctrl_usdhc1_1_200mhz>;
+-      bus-width = <8>;
+-      cd-gpios = <&gpio4 7 0>;
+-      wp-gpios = <&gpio4 6 0>;
+-      keep-power-in-suspend;
+-      enable-sdio-wakeup;
+-      status = "okay";
+-};
+-
+ &usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2_1>;
+@@ -530,12 +546,21 @@
+ };
+ &usdhc3 {
+-      pinctrl-names = "default", "state_100mhz", "state_200mhz";
++      pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3_1>;
+-      pinctrl-1 = <&pinctrl_usdhc3_1_100mhz>;
+-      pinctrl-2 = <&pinctrl_usdhc3_1_200mhz>;
+-      cd-gpios = <&gpio3 22 0>;
+       keep-power-in-suspend;
+       enable-sdio-wakeup;
++      vmmc-supply = <&wlan_en_reg>;
++      non-removable;    // non-removable is not a variable, the fact it is listed is all that is used by driver
++      cap-power-off-card;
+       status = "okay";
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wlcore";
++              reg = <2>;
++              interrupt-parent = <&gpio5>;
++              interrupts = <8 0>;
++              platform-quirks = <1>;
++      };
+ };
+diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
+index 4900b73..834f2b4 100644
+--- a/arch/arm/boot/dts/imx6sl.dtsi
++++ b/arch/arm/boot/dts/imx6sl.dtsi
+@@ -1168,19 +1168,11 @@
+       uart4 {
+               pinctrl_uart4_1: uart4grp-1 {
+                       fsl,pins = <
+-                              MX6SL_PAD_SD1_DAT4__UART4_RX_DATA 0x1b0b1
+-                              MX6SL_PAD_SD1_DAT5__UART4_TX_DATA 0x1b0b1
+-                              MX6SL_PAD_SD1_DAT7__UART4_CTS_B   0x1b0b1
+-                              MX6SL_PAD_SD1_DAT6__UART4_RTS_B   0x1b0b1
+-                      >;
+-              };
+-
+-              pinctrl_uart4dte_1: uart4dtegrp-1 {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD1_DAT5__UART4_RX_DATA 0x1b0b1
+-                              MX6SL_PAD_SD1_DAT4__UART4_TX_DATA 0x1b0b1
+-                              MX6SL_PAD_SD1_DAT6__UART4_CTS_B   0x1b0b1
+-                              MX6SL_PAD_SD1_DAT7__UART4_RTS_B   0x1b0b1
++                              MX6SL_PAD_SD1_DAT4__UART4_RX_DATA 0x13059 // used for HOST_HCI_RX
++                              MX6SL_PAD_SD1_DAT5__UART4_TX_DATA 0x13059 // used for HOST_HCI_TX
++                              MX6SL_PAD_SD1_DAT7__UART4_CTS_B 0x13059   // used for HOST_HCI_RTS, note reversed to TI nomenclature
++                              MX6SL_PAD_SD1_DAT6__UART4_RTS_B 0x13059   // used for HOST_HCI_CTS
++                              MX6SL_PAD_SD1_DAT3__GPIO5_IO06  0x13059   // used for BT_EN
+                       >;
+               };
+       };
+@@ -1335,30 +1327,9 @@
+                               MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x17059
+                               MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x17059
+                               MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059
++                              MX6SL_PAD_SD1_DAT2__GPIO5_IO13  0x13059   // reserve two pins from sd1 for wl8 gpio, this is pulled low at reset for WL_EN
++                              MX6SL_PAD_SD1_DAT1__GPIO5_IO08  0x13059   // this is for wl_irq which driver will configure as an input with a pull down
+                       >;
+               };
+-
+-              pinctrl_usdhc3_1_100mhz: usdhc3grp-1-100mhz {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD    0x170b9
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK    0x100b9
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170b9
+-                              MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170b9
+-                              MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170b9
+-                              MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170b9
+-                      >;
+-              };
+-
+-              pinctrl_usdhc3_1_200mhz: usdhc3grp-1-200mhz {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD    0x170f9
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK    0x100f9
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170f9
+-                              MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170f9
+-                              MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170f9
+-                              MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170f9
+-                      >;
+-              };
+-
+       };
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch
new file mode 100644 (file)
index 0000000..264de5e
--- /dev/null
@@ -0,0 +1,64 @@
+From 006933d011363302081d48b233b2a72e91562179 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 2 Apr 2015 14:47:15 +0300
+Subject: [PATCH 09/15] imx6: decrease wilink8 sdio pins drive strength
+
+The original drive strength value of 90 OHM was too strong causing
+detection issues of some modules on the sdio bus.
+Reducing the io strength to 50 OHM solves this issue
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl.dtsi |   12 ++++++------
+ arch/arm/boot/dts/imx6sl.dtsi  |   12 ++++++------
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
+index 72ad23e..0f48f4c 100644
+--- a/arch/arm/boot/dts/imx6qdl.dtsi
++++ b/arch/arm/boot/dts/imx6qdl.dtsi
+@@ -1685,12 +1685,12 @@
+               pinctrl_usdhc2_2: usdhc2grp-2 {
+                       fsl,pins = <
+-                              MX6QDL_PAD_SD2_CMD__SD2_CMD    0x17059
+-                              MX6QDL_PAD_SD2_CLK__SD2_CLK    0x10059
+-                              MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
+-                              MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
+-                              MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
+-                              MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
++                              MX6QDL_PAD_SD2_CMD__SD2_CMD    0x17069
++                              MX6QDL_PAD_SD2_CLK__SD2_CLK    0x10069
++                              MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17069
++                              MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17069
++                              MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17069
++                              MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17069
+                       >;
+               };
+       };
+diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
+index 834f2b4..0b288b1 100644
+--- a/arch/arm/boot/dts/imx6sl.dtsi
++++ b/arch/arm/boot/dts/imx6sl.dtsi
+@@ -1321,12 +1321,12 @@
+       usdhc3 {
+               pinctrl_usdhc3_1: usdhc3grp-1 {
+                       fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD    0x17059
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK    0x10059
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x17059
+-                              MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x17059
+-                              MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x17059
+-                              MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059
++                              MX6SL_PAD_SD3_CMD__SD3_CMD    0x17069
++                              MX6SL_PAD_SD3_CLK__SD3_CLK    0x10069
++                              MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x17069
++                              MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x17069
++                              MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x17069
++                              MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17069
+                               MX6SL_PAD_SD1_DAT2__GPIO5_IO13  0x13059   // reserve two pins from sd1 for wl8 gpio, this is pulled low at reset for WL_EN
+                               MX6SL_PAD_SD1_DAT1__GPIO5_IO08  0x13059   // this is for wl_irq which driver will configure as an input with a pull down
+                       >;
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch
new file mode 100644 (file)
index 0000000..9bc6be1
--- /dev/null
@@ -0,0 +1,152 @@
+From 3ee9f48a0a59de62fa461a0623293e37558c05f3 Mon Sep 17 00:00:00 2001
+From: Sascha Hauer <s.hauer@pengutronix.de>
+Date: Mon, 30 Jun 2014 11:07:25 +0200
+Subject: [PATCH 10/15] mmc: Add SDIO function devicetree subnode parsing
+
+This adds SDIO devicetree subnode parsing to the mmc core. While
+SDIO devices are runtime probable they sometimes need nonprobable
+additional information on embedded systems, like an additional gpio
+interrupt or a clock. This patch makes it possible to supply this
+information from the devicetree. SDIO drivers will find a pointer
+to the devicenode in their devices of_node pointer.
+
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+[hdegoede@redhat.com: Misc. cleanups]
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+---
+ drivers/mmc/core/bus.c      |    4 ++++
+ drivers/mmc/core/core.c     |   28 ++++++++++++++++++++++++++++
+ drivers/mmc/core/core.h     |    3 +++
+ drivers/mmc/core/sdio_bus.c |   11 +++++++++++
+ 4 files changed, 46 insertions(+)
+
+diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
+index e219c97..af6ec34 100644
+--- a/drivers/mmc/core/bus.c
++++ b/drivers/mmc/core/bus.c
+@@ -16,6 +16,7 @@
+ #include <linux/err.h>
+ #include <linux/slab.h>
+ #include <linux/stat.h>
++#include <linux/of.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/mmc/card.h>
+@@ -323,6 +324,8 @@ int mmc_add_card(struct mmc_card *card)
+ #endif
+       mmc_init_context_info(card->host);
++      card->dev.of_node = mmc_of_find_child_device(card->host, 0);
++
+       ret = device_add(&card->dev);
+       if (ret)
+               return ret;
+@@ -351,6 +354,7 @@ void mmc_remove_card(struct mmc_card *card)
+                               mmc_hostname(card->host), card->rca);
+               }
+               device_del(&card->dev);
++              of_node_put(card->dev.of_node);
+       }
+       put_device(&card->dev);
+diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
+index f5aeb24..1152580 100644
+--- a/drivers/mmc/core/core.c
++++ b/drivers/mmc/core/core.c
+@@ -1163,6 +1163,34 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max)
+ }
+ EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);
++static int mmc_of_get_func_num(struct device_node *node)
++{
++      u32 reg;
++      int ret;
++
++      ret = of_property_read_u32(node, "reg", &reg);
++      if (ret < 0)
++              return ret;
++
++      return reg;
++}
++
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num)
++{
++      struct device_node *node;
++
++      if (!host->parent || !host->parent->of_node)
++              return NULL;
++
++      for_each_child_of_node(host->parent->of_node, node) {
++              if (mmc_of_get_func_num(node) == func_num)
++                      return node;
++      }
++
++      return NULL;
++}
++
+ #ifdef CONFIG_REGULATOR
+ /**
+diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
+index b9f18a2..6b01037 100644
+--- a/drivers/mmc/core/core.h
++++ b/drivers/mmc/core/core.h
+@@ -30,6 +30,9 @@ struct mmc_bus_ops {
+ void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
+ void mmc_detach_bus(struct mmc_host *host);
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num);
++
+ void mmc_init_erase(struct mmc_card *card);
+ void mmc_set_chip_select(struct mmc_host *host, int mode);
+diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
+index c012cf5..6078715 100644
+--- a/drivers/mmc/core/sdio_bus.c
++++ b/drivers/mmc/core/sdio_bus.c
+@@ -21,7 +21,9 @@
+ #include <linux/mmc/card.h>
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sdio_func.h>
++#include <linux/of.h>
++#include "core.h"
+ #include "sdio_cis.h"
+ #include "sdio_bus.h"
+@@ -323,6 +325,13 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
+ static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
+ #endif
++static void sdio_set_of_node(struct sdio_func *func)
++{
++      struct mmc_host *host = func->card->host;
++
++      func->dev.of_node = mmc_of_find_child_device(host, func->num);
++}
++
+ /*
+  * Register a new SDIO function with the driver model.
+  */
+@@ -332,6 +341,7 @@ int sdio_add_func(struct sdio_func *func)
+       dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
++      sdio_set_of_node(func);
+       sdio_acpi_set_handle(func);
+       ret = device_add(&func->dev);
+       if (ret == 0) {
+@@ -355,6 +365,7 @@ void sdio_remove_func(struct sdio_func *func)
+       acpi_dev_pm_detach(&func->dev, false);
+       device_del(&func->dev);
++      of_node_put(func->dev.of_node);
+       put_device(&func->dev);
+ }
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0011-imx6q-sabresd-update-wilink8-entries-for-r8.6.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0011-imx6q-sabresd-update-wilink8-entries-for-r8.6.patch
new file mode 100644 (file)
index 0000000..2ba94b4
--- /dev/null
@@ -0,0 +1,42 @@
+From b9ff824dfea694de7693f438e8d60265de0fbcce Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 12 Aug 2015 14:53:33 +0300
+Subject: [PATCH 11/15] imx6q-sabresd: update wilink8 entries for r8.6
+
+Due to changes in upstream there are a couple of device tree related
+parameters that are needed for wilink8 initialization that have changed
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl-sabresd.dtsi |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+index e4daafd..b6dd73c 100644
+--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+@@ -9,6 +9,7 @@
+  * http://www.opensource.org/licenses/gpl-license.html
+  * http://www.gnu.org/copyleft/gpl.html
+  */
++#include <dt-bindings/interrupt-controller/irq.h>
+ / {
+       aliases {
+@@ -743,11 +744,10 @@
+       #address-cells = <1>;
+       #size-cells = <0>;
+       wlcore: wlcore@0 {
+-              compatible = "ti,wlcore";
++              compatible = "ti,wl1835";
+               reg = <2>;
+               interrupt-parent = <&gpio4>;
+-              interrupts = <6 0>;
+-              platform-quirks = <1>;
++              interrupts = <6 IRQ_TYPE_EDGE_RISING>;
+       };
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0012-imx6sl-evk-update-wilink8-entries-for-r8.6.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0012-imx6sl-evk-update-wilink8-entries-for-r8.6.patch
new file mode 100644 (file)
index 0000000..8c8462c
--- /dev/null
@@ -0,0 +1,62 @@
+From 3a74fe6b3b54cceabf6747e478824e42b8132ffc Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 12 Aug 2015 14:53:58 +0300
+Subject: [PATCH 12/15] imx6sl-evk: update wilink8 entries for r8.6
+
+* Due to changes in upstream there are a couple of device tree related
+  parameters that are needed for wilink8 initialization that have changed
+* remove resundant entry for usdhc3 that is used by wilink8
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6sl-evk-common.dtsi |    6 +++---
+ arch/arm/boot/dts/imx6sl-evk.dts         |   11 -----------
+ 2 files changed, 3 insertions(+), 14 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6sl-evk-common.dtsi b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+index 43258d5..8e67dd0 100644
+--- a/arch/arm/boot/dts/imx6sl-evk-common.dtsi
++++ b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+@@ -5,6 +5,7 @@
+  * it under the terms of the GNU General Public License version 2 as
+  * published by the Free Software Foundation.
+  */
++#include <dt-bindings/interrupt-controller/irq.h>
+ / {
+       memory {
+@@ -557,10 +558,9 @@
+       #address-cells = <1>;
+       #size-cells = <0>;
+       wlcore: wlcore@0 {
+-              compatible = "ti,wlcore";
++              compatible = "ti,wl1835";
+               reg = <2>;
+               interrupt-parent = <&gpio5>;
+-              interrupts = <8 0>;
+-              platform-quirks = <1>;
++              interrupts = <8 IRQ_TYPE_EDGE_RISING>;
+       };
+ };
+diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
+index bf67dae..6d18824 100644
+--- a/arch/arm/boot/dts/imx6sl-evk.dts
++++ b/arch/arm/boot/dts/imx6sl-evk.dts
+@@ -417,14 +417,3 @@
+       enable-sdio-wakeup;
+       status = "okay";
+ };
+-
+-&usdhc3 {
+-      pinctrl-names = "default", "state_100mhz", "state_200mhz";
+-      pinctrl-0 = <&pinctrl_usdhc3_1>;
+-      pinctrl-1 = <&pinctrl_usdhc3_1_100mhz>;
+-      pinctrl-2 = <&pinctrl_usdhc3_1_200mhz>;
+-      cd-gpios = <&gpio3 22 0>;
+-      keep-power-in-suspend;
+-      enable-sdio-wakeup;
+-      status = "okay";
+-};
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0013-imx_v7_android_defconfig-enable-Wilink8-related-swit.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0013-imx_v7_android_defconfig-enable-Wilink8-related-swit.patch
new file mode 100644 (file)
index 0000000..be2a658
--- /dev/null
@@ -0,0 +1,96 @@
+From 5455b039c75abff93b7cb0a2d2023a9a100e6286 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 31 Aug 2015 09:33:38 +0300
+Subject: [PATCH 13/15] imx_v7_android_defconfig: enable Wilink8 related
+ switches
+
+* Disable internal mac80211 and cfg80211 as we are building wilink8
+  drivers using backport and loading as modules
+* enable wlan and hci related switches
+* enable bluetooth shared transport
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/configs/imx_v7_android_defconfig |   36 ++++++++---------------------
+ 1 file changed, 10 insertions(+), 26 deletions(-)
+
+diff --git a/arch/arm/configs/imx_v7_android_defconfig b/arch/arm/configs/imx_v7_android_defconfig
+index b3bbd23..5f81f65 100644
+--- a/arch/arm/configs/imx_v7_android_defconfig
++++ b/arch/arm/configs/imx_v7_android_defconfig
+@@ -336,7 +336,7 @@ CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX=y
+ CONFIG_IMX_HAVE_PLATFORM_SPI_IMX=y
+ CONFIG_MXC_REBOOT_ANDROID_CMD=y
+ CONFIG_MXC_REBOOT_MFGMODE=y
+-CONFIG_MACH_IMX_BLUETOOTH_RFKILL=y
++# CONFIG_MACH_IMX_BLUETOOTH_RFKILL is not set
+ CONFIG_MX6_IR=y
+ CONFIG_MX6_RAMOOPS=y
+ # CONFIG_ARCH_OMAP2PLUS is not set
+@@ -981,34 +981,15 @@ CONFIG_BT_HCIBTUSB=y
+ CONFIG_BT_HCIUART=y
+ CONFIG_BT_HCIUART_ATH3K=y
+ CONFIG_BT_HCIVHCI=y
++CONFIG_BT_WILINK=y
++CONFIG_BT_HCIUART_LL=y
+ CONFIG_FIB_RULES=y
+ CONFIG_WIRELESS=y
+ CONFIG_WEXT_CORE=y
+ CONFIG_WEXT_PROC=y
+-CONFIG_CFG80211=m
+-# CONFIG_NL80211_TESTMODE is not set
+-# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+-# CONFIG_CFG80211_REG_DEBUG is not set
+-# CONFIG_CFG80211_CERTIFICATION_ONUS is not set
+-CONFIG_CFG80211_DEFAULT_PS=y
+-# CONFIG_CFG80211_DEBUGFS is not set
+-# CONFIG_CFG80211_INTERNAL_REGDB is not set
+-CONFIG_CFG80211_WEXT=y
+-# CONFIG_LIB80211 is not set
+-CONFIG_CFG80211_ALLOW_RECONNECT=y
+-CONFIG_MAC80211=m
+-CONFIG_MAC80211_HAS_RC=y
+-# CONFIG_MAC80211_RC_PID is not set
+-CONFIG_MAC80211_RC_MINSTREL=y
+-CONFIG_MAC80211_RC_MINSTREL_HT=y
+-CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
+-CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
+-# CONFIG_MAC80211_MESH is not set
+-# CONFIG_MAC80211_LEDS is not set
+-# CONFIG_MAC80211_DEBUGFS is not set
+-# CONFIG_MAC80211_MESSAGE_TRACING is not set
+-# CONFIG_MAC80211_DEBUG_MENU is not set
++# CONFIG_CFG80211 is not set
++# CONFIG_MAC80211 is not set
+ # CONFIG_WIMAX is not set
+ CONFIG_RFKILL=y
+ CONFIG_RFKILL_PM=y
+@@ -1177,7 +1158,7 @@ CONFIG_OF=y
+ #
+ # Device Tree and Open Firmware support
+ #
+-# CONFIG_PROC_DEVICETREE is not set
++CONFIG_PROC_DEVICETREE=y
+ # CONFIG_OF_SELFTEST is not set
+ CONFIG_OF_FLATTREE=y
+ CONFIG_OF_EARLY_FLATTREE=y
+@@ -1246,7 +1227,8 @@ CONFIG_EEPROM_AT25=y
+ #
+ # Texas Instruments shared transport line discipline
+ #
+-# CONFIG_TI_ST is not set
++CONFIG_TI_ST=y
++CONFIG_ST_HCI=y
+ # CONFIG_SENSORS_LIS3_SPI is not set
+ # CONFIG_SENSORS_LIS3_I2C is not set
+@@ -3739,3 +3721,5 @@ CONFIG_AVERAGE=y
+ # CONFIG_DDR is not set
+ CONFIG_OID_REGISTRY=y
+ # CONFIG_VIRTUALIZATION is not set
++#TI add for WL8
++CONFIG_IP_NF_TARGET_LOG=y
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0014-drivers-misc-ti-st-fix-debugfs-creation-error-handli.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0014-drivers-misc-ti-st-fix-debugfs-creation-error-handli.patch
new file mode 100644 (file)
index 0000000..90bfbbc
--- /dev/null
@@ -0,0 +1,44 @@
+From 6b291ea73405f91ceb7abd384152110601dac167 Mon Sep 17 00:00:00 2001
+From: Gigi Joseph <gigi.joseph@gmail.com>
+Date: Fri, 9 Jan 2015 03:47:51 +0000
+Subject: [PATCH 14/15] drivers: misc: ti-st: fix debugfs creation error
+ handling
+
+In case the debugfs creation fails the whole init process was failing.
+There is no need to do this as the shared transport can work without it.
+Fix it so it just reports the failure and continue.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: Gigi Joseph <gigi.joseph@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/ti-st/st_kim.c |    6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index 8cb48b1..b0cddef 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -837,8 +837,7 @@ static int kim_probe(struct platform_device *pdev)
+       kim_debugfs_dir = debugfs_create_dir("ti-st", NULL);
+       if (IS_ERR(kim_debugfs_dir)) {
+               pr_err(" debugfs entries creation failed ");
+-              err = -EIO;
+-              goto err_debugfs_dir;
++              return 0;
+       }
+       debugfs_create_file("version", S_IRUGO, kim_debugfs_dir,
+@@ -847,9 +846,6 @@ static int kim_probe(struct platform_device *pdev)
+                               kim_gdata, &list_debugfs_fops);
+       pr_info(" debugfs entries created ");
+       return 0;
+-
+-err_debugfs_dir:
+-      sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
+ #endif
+ err_sysfs_group:
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0015-drivers-misc-ti-st-fix-null-pointer-exception-in-st_.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/0015-drivers-misc-ti-st-fix-null-pointer-exception-in-st_.patch
new file mode 100644 (file)
index 0000000..5f79d56
--- /dev/null
@@ -0,0 +1,66 @@
+From a4b96024f961a89f72bdc422f8ba4c8b64349969 Mon Sep 17 00:00:00 2001
+From: Gigi Joseph <gigi.joseph@gmail.com>
+Date: Fri, 9 Jan 2015 03:48:29 +0000
+Subject: [PATCH 15/15] drivers: misc: ti-st: fix null pointer exception in
+ st_kim_ref()
+
+st_kim_ref() does not take care of the fact that platform_get_drvdata() might return NULL. On AM437x EVM, this causes the platform to stop booting as soon as the module is inserted.
+
+This patch fixes the issue by checking for NULL return value. Oops log follows.
+
+I have not tested BT functionality after this patch. But at least the platform boots now.
+
+[   12.675697] Unable to handle kernel NULL pointer dereference at virtual address 0000005c
+[   12.684310] pgd = c0004000
+[   12.687157] [0000005c] *pgd=00000000
+[   12.690927] Internal error: Oops: 17 [#1] SMP ARM
+[   12.695873] Modules linked in: btwilink bluetooth ti_vpfe dwc3(+) ov2659 videobuf2_core v4l2_common videodev ti_am335x_adc 6lowpan_iphc matrix_keypad panel_dpi kfifo_buf pixcir_i2c_ts media industrialio videobuf2_dma_contig c_can_platform videobuf2_memops dwc3_omap c_can can_dev
+[   12.721969] CPU: 0 PID: 1235 Comm: kworker/u3:0 Not tainted 3.14.25-02445-g9036ac6daed6 #128
+[   12.730937] Workqueue: hci0 hci_power_on [bluetooth]
+[   12.736165] task: ebd93b40 ti: ecd7c000 task.ti: ecd7c000
+[   12.741856] PC is at st_kim_ref+0x30/0x40
+[   12.746071] LR is at st_kim_ref+0x30/0x40
+[   12.750289] pc : [<c03caf58>]    lr : [<c03caf58>]    psr: a0000013
+[   12.750289] sp : ecd7de08  ip : ecd7de08  fp : ecd7de1c
+[   12.762365] r10: bf1e710c  r9 : bf1e70ec  r8 : bf1e7964
+[   12.767858] r7 : ebd2fd50  r6 : bf1e7964  r5 : 00000000  r4 : ecd7de24
+[   12.774723] r3 : c0957208  r2 : 00000000  r1 : c0957208  r0 : 00000000
+[   12.781589] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
+[   12.789274] Control: 10c5387d  Table: abde4059  DAC: 00000015
+[   12.795315] Process kworker/u3:0 (pid: 1235, stack limit = 0xecd7c248)
+
+Signed-off-by: Sekhar Nori <nsekhar@ti.com>
+Signed-off-by: Gigi Joseph <gigi.joseph@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/ti-st/st_kim.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index b0cddef..e37fd5f 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -691,12 +691,16 @@ void st_kim_ref(struct st_data_s **core_data, int id)
+       struct kim_data_s       *kim_gdata;
+       /* get kim_gdata reference from platform device */
+       pdev = st_get_plat_device(id);
+-      if (!pdev) {
+-              *core_data = NULL;
+-              return;
+-      }
++      if (!pdev)
++              goto err;
+       kim_gdata = dev_get_drvdata(&pdev->dev);
++      if (!kim_gdata)
++              goto err;
++
+       *core_data = kim_gdata->core_data;
++      return;
++err:
++      *core_data = NULL;
+ }
+ static int kim_version_open(struct inode *i, struct file *f)
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/device-fsl-patches/0001-sabresd_6dq-add-wilink8-platform-support.patch b/patches/kernel_patches/imx-3.10.53-android-5.0.0_1.0.0-ga/device-fsl-patches/0001-sabresd_6dq-add-wilink8-platform-support.patch
new file mode 100644 (file)
index 0000000..6faeab4
--- /dev/null
@@ -0,0 +1,156 @@
+From 23812cf98a814b8e410854bd329881b919ed9e91 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 26 Aug 2015 09:36:57 +0300
+Subject: [PATCH] sabresd_6dq: add wilink8 platform support
+
+Add wilink8 support to the imx6 sabresd board.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ imx6/etc/init.rc              |   15 ++++++++++++---
+ imx6/etc/ueventd.freescale.rc |    3 ++-
+ imx6/sabresd_6dq.mk           |    3 +++
+ sabresd_6dq/BoardConfig.mk    |   20 ++++++++++++++++++--
+ sabresd_6dq/init.rc           |   19 +++++++++++++++----
+ 5 files changed, 50 insertions(+), 10 deletions(-)
+
+diff --git a/imx6/etc/init.rc b/imx6/etc/init.rc
+index ee6b1a3..77f2d5c 100755
+--- a/imx6/etc/init.rc
++++ b/imx6/etc/init.rc
+@@ -360,6 +360,15 @@ on post-fs-data
+     setprop vold.post_fs_data_done 1
+ on boot
++    # wi-fi
++    insmod /system/lib/modules/compat.ko
++    insmod /system/lib/modules/cfg80211.ko
++    insmod /system/lib/modules/mac80211.ko
++    insmod /system/lib/modules/wlcore.ko
++    insmod /system/lib/modules/wl12xx.ko
++    insmod /system/lib/modules/wl18xx.ko
++    insmod /system/lib/modules/wlcore_sdio.ko
++
+     # basic network init
+     ifup lo
+     hostname localhost
+@@ -480,9 +489,9 @@ on boot
+     setprop wifi.ap.interface wlan0
+     # Prepare for bluetooth
+-    chmod 665 /sys/class/rfkill/rfkill0/state
+-    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
+-    write /sys/class/rfkill/rfkill0/state 0
++    # change permissions for Bluetooth/FM/GPS
++    chmod 0660 /dev/ttymxc4
++    chown bluetooth bluetooth /dev/ttymxc4
+     # Prepare for RIL
+     setprop gsm.ril.delay 15
+diff --git a/imx6/etc/ueventd.freescale.rc b/imx6/etc/ueventd.freescale.rc
+index 1d6f3a2..7a5df20 100644
+--- a/imx6/etc/ueventd.freescale.rc
++++ b/imx6/etc/ueventd.freescale.rc
+@@ -1,5 +1,6 @@
+ /dev/pmem_gpu             0660   system     graphics
+-/dev/ttymxc4              0660   bluetooth  bluetooth
++# for Bluetooth
++/dev/hci_tty              0666   bluetooth bluetooth
+ /dev/snd/*                0660   system     audio
+ /dev/ttyUSB*              0640   radio      radio
+ /dev/ttyACM*              0640   radio      radio
+diff --git a/imx6/sabresd_6dq.mk b/imx6/sabresd_6dq.mk
+index 56cef9d..911604e 100644
+--- a/imx6/sabresd_6dq.mk
++++ b/imx6/sabresd_6dq.mk
+@@ -57,3 +57,6 @@ PRODUCT_COPY_FILES += \
+       frameworks/native/data/etc/android.hardware.consumerir.xml:system/etc/permissions/android.hardware.consumerir.xml \
+       frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml \
+       device/fsl/sabresd_6dq/required_hardware.xml:system/etc/permissions/required_hardware.xml
++
++$(call inherit-product-if-exists, device/ti/proprietary-open/wl12xx/wlan/wl12xx-wlan-fw-products.mk)
++$(call inherit-product-if-exists, device/ti/proprietary-open/wl12xx/wpan/wl12xx-wpan-fw-products.mk)
+diff --git a/sabresd_6dq/BoardConfig.mk b/sabresd_6dq/BoardConfig.mk
+index 88d2341..936c780 100644
+--- a/sabresd_6dq/BoardConfig.mk
++++ b/sabresd_6dq/BoardConfig.mk
+@@ -70,6 +70,22 @@ WIFI_DRIVER_MODULE_NAME                  := "iwlagn"
+ WIFI_DRIVER_MODULE_PATH                  ?= auto
+ endif
++# Connectivity - Wi-Fi
++USES_TI_MAC80211 := true
++ifeq ($(USES_TI_MAC80211),true)
++BOARD_WPA_SUPPLICANT_DRIVER := NL80211
++WPA_SUPPLICANT_VERSION      := VER_0_8_X
++BOARD_HOSTAPD_DRIVER        := NL80211
++BOARD_WPA_SUPPLICANT_PRIVATE_LIB  := lib_driver_cmd_wl12xx
++BOARD_HOSTAPD_PRIVATE_LIB         := lib_driver_cmd_wl12xx
++BOARD_WLAN_DEVICE           := wl12xx_mac80211
++BOARD_SOFTAP_DEVICE         := wl12xx_mac80211
++COMMON_GLOBAL_CFLAGS += -DUSES_TI_MAC80211
++COMMON_GLOBAL_CFLAGS += -DANDROID_P2P_STUB
++endif
++
++BOARD_HAVE_BLUETOOTH_TI := true
++
+ BOARD_MODEM_VENDOR := AMAZON
+ USE_ATHR_GPS_HARDWARE := true
+@@ -110,8 +126,8 @@ BOARD_KERNEL_CMDLINE +=  mtdparts=gpmi-nand:16m(bootloader),16m(bootimg),128m(re
+ endif
+ # atheros 3k BT
+-BOARD_USE_AR3K_BLUETOOTH := true
+-BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/fsl/sabresd_6dq/bluetooth
++# BOARD_USE_AR3K_BLUETOOTH := true
++# BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/fsl/sabresd_6dq/bluetooth
+ USE_ION_ALLOCATOR := false
+ USE_GPU_ALLOCATOR := true
+diff --git a/sabresd_6dq/init.rc b/sabresd_6dq/init.rc
+index 3af7bcc..62ccb97 100755
+--- a/sabresd_6dq/init.rc
++++ b/sabresd_6dq/init.rc
+@@ -18,6 +18,14 @@ on init
+     symlink /mnt/shell/emulated/0 /storage/emulated/legacy
+ on boot
++    # wi-fi
++    insmod /system/lib/modules/compat.ko
++    insmod /system/lib/modules/cfg80211.ko
++    insmod /system/lib/modules/mac80211.ko
++    insmod /system/lib/modules/wlcore.ko
++    insmod /system/lib/modules/wl12xx.ko
++    insmod /system/lib/modules/wl18xx.ko
++    insmod /system/lib/modules/wlcore_sdio.ko
+     # Set permission for IIM node
+     symlink /dev/mxs_viim /dev/mxc_mem
+@@ -119,16 +127,19 @@ on charger
+     write /sys/devices/system/cpu/cpu2/online 0
+     write /sys/devices/system/cpu/cpu3/online 0
++#shared transport user space mgr service for Bluetooth, FM and GPS
++service uim /system/bin/uim-sysfs
++    class core
++    user root
++    group bluetooth net_bt_admin
+ service p2p_supplicant /system/bin/wpa_supplicant \
+-    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
+-    -I/system/etc/wifi/p2p_supplicant_advance_overlay.conf -N \
+     -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
+     -I/system/etc/wifi/wpa_supplicant_overlay.conf \
+-    -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
++    -O/data/misc/wifi/sockets -pp2p_device=1\
+     -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
+-    class late_start
+     socket wpa_wlan0 dgram 660 wifi wifi
++    class late_start
+     disabled
+     oneshot
+-- 
+1.7.9.5
+
index be968f2e5b71a62379f79d7df978171432608387..42e2b959b22c0a972004a34c509fafc95751b320 100644 (file)
@@ -1,7 +1,7 @@
-From e53032e6ab7e3498e8d9f6539a96f3cda6f35aa8 Mon Sep 17 00:00:00 2001
+From efde6f3653bd70a9cd92bfdf882ffc3fa2fbf442 Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Wed, 4 Mar 2015 14:08:59 +0200
-Subject: [PATCH 1/7] imx6q-sabresd: add support for wilink8 wlan and
+Subject: [PATCH 01/12] imx6q-sabresd: add support for wilink8 wlan and
  bluetooth
 
 * enable uart5 used for bluetooth with wilink8 with flow control
index c4392a23674e0803b2da9227d17738c551d76ed9..28082c591f43554074f283b28034c01efd30733c 100644 (file)
@@ -1,7 +1,7 @@
-From c55f8870f94fef8a588358e4e2ff6eb368eb21bd Mon Sep 17 00:00:00 2001
+From fcce881cb85ca283e142b624133893c5b714433f Mon Sep 17 00:00:00 2001
 From: Pavan Savoy <pavan_savoy@ti.com>
 Date: Mon, 15 Oct 2012 17:47:35 -0500
-Subject: [PATCH 2/7] Bluetooth: Add tty HCI driver
+Subject: [PATCH 02/12] Bluetooth: Add tty HCI driver
 
 tty_hci driver exposes a /dev/hci_tty character device node, that intends to
 emulate a generic /dev/ttyX device that would be used by the user-space
index 77cdec80fc8f83b1cd903acf6998c1a5016d3dcd..38993f00bc389db0a41fc2d3638c293c3c160e72 100644 (file)
@@ -1,7 +1,7 @@
-From fe548307100be21e83157e61d1dd55ffef4029bb Mon Sep 17 00:00:00 2001
+From 3f7c2a040fe4d757705a4047ee9b4e41ed09fdde Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Wed, 4 Mar 2015 14:13:15 +0200
-Subject: [PATCH 3/7] imx_v7_defconfig: enable Wilink8 related switches
+Subject: [PATCH 03/12] imx_v7_defconfig: enable Wilink8 related switches
 
 * Disable internal mac80211 and cfg80211 as we are building wilink8
   drivers using backport and loading as modules
index feac96e688260fd3674734bfdce869debad84d68..bb09f5c182b76c200e1e9aeec5078e6c31e73509 100644 (file)
@@ -1,7 +1,7 @@
-From 3bc3ac098de1c999020e40601d2db99ae5e1b2f0 Mon Sep 17 00:00:00 2001
+From 7323198b3c5cb19d22eff545c1b324a5e3e5efac Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Wed, 29 Jan 2014 09:24:06 +0200
-Subject: [PATCH 4/7] st_kim: do not use debugfs functions if not enabled
+Subject: [PATCH 04/12] st_kim: do not use debugfs functions if not enabled
 
 the probe function was using debugfs apis without checking if
 CONFIG_DEBUG_FS was enabled resulting with runtime errors.
index 546acfaebd60875daed92d58a51f0974e807458a..0183180fbdc9215bcb429220c6031332242975f0 100644 (file)
@@ -1,7 +1,7 @@
-From 9f77068002ef057a1e01496f612853a6b35dde00 Mon Sep 17 00:00:00 2001
+From c66808006cecb73fb66335a0ccb9f5a6748054cd Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Wed, 29 Jan 2014 09:03:41 +0200
-Subject: [PATCH 5/7] st_kim: allow suspend if callback is not registered
+Subject: [PATCH 05/12] st_kim: allow suspend if callback is not registered
 
 Suspend/resume was failing if callbacks were not registered.
 As it is ok not to do anything when suspending fix this
index 845d89a2de1f4fc8e0c640520e25273f5c0fb376..f9f135ae1224ac4891ccda5e4492f93c4fa1395a 100644 (file)
@@ -1,7 +1,7 @@
-From 83e32f317a02df2419bda2b4be614ce31e7bc1e3 Mon Sep 17 00:00:00 2001
+From 4574502db4fa34c175281ced74d828ec288b9d74 Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Thu, 23 May 2013 17:15:21 +0300
-Subject: [PATCH 6/7] btwilink: add minimal device tree support
+Subject: [PATCH 06/12] btwilink: add minimal device tree support
 
 Add minimal device tree support to the btwilink driver that is used
 for binding bluetooth with the ti-st shared transport driver.
index 8975200fa97975f8345dbb050b78917f6568adac..0e5289b60c7898c862761960a0efe6eafb92b044 100644 (file)
@@ -1,7 +1,7 @@
-From 78403fb3232ba53c9f8d9499879edbba60a29cc8 Mon Sep 17 00:00:00 2001
+From 3658d7f654aa182a148dac65a74752b0b38a5dbc Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Thu, 23 May 2013 17:11:14 +0300
-Subject: [PATCH 7/7] ti-st: add device tree support
+Subject: [PATCH 07/12] ti-st: add device tree support
 
 When using device tree, driver configuration data need to be read from
 device node.
index b983f2c979b9ae88862d05f00d61dcc6d521fe6b..9c8bd2e4fdee7daaedb06f1dfd245bcfcc9e8060 100644 (file)
@@ -1,7 +1,7 @@
-From 92adbbd7e6082277eb1865a7b8b3c24a8cab8fe3 Mon Sep 17 00:00:00 2001
+From e05052a1ef78b91a5f801f8f73df1a81ee42c9bd Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Mon, 23 Mar 2015 13:14:06 +0200
-Subject: [PATCH] imx6sl-evk: add support for wilink8 wlan and bluetooth
+Subject: [PATCH 08/12] imx6sl-evk: add support for wilink8 wlan and bluetooth
 
 * enable uart4 used for bluetooth with wilink8 with flow control
 * configure SD3 to be used for sdio communication to wilink8 wlan
index bd6f280700aed1e103b15f51dadb10eb9f19dd60..cac377e4dc2ea3b1b801fc4593ceea3ed9887a99 100644 (file)
@@ -1,7 +1,7 @@
-From 3f1b360d3954c688eb1f2e0e51d59b60006c4163 Mon Sep 17 00:00:00 2001
+From 585c064b1220a89194a1b76a339ed80eb291c231 Mon Sep 17 00:00:00 2001
 From: Eyal Reizer <eyalr@ti.com>
 Date: Thu, 2 Apr 2015 14:47:15 +0300
-Subject: [PATCH] imx6: decrease wilink8 sdio pins drive strength
+Subject: [PATCH 09/12] imx6: decrease wilink8 sdio pins drive strength
 
 The original drive strength value of 90 OHM was too strong causing
 detection issues of some modules on the sdio bus.
diff --git a/patches/kernel_patches/imx-3.10.53/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch b/patches/kernel_patches/imx-3.10.53/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch
new file mode 100644 (file)
index 0000000..5d55bdd
--- /dev/null
@@ -0,0 +1,152 @@
+From 81b2bd9f7329ba03bed7543e91a4cefe618d8bb9 Mon Sep 17 00:00:00 2001
+From: Sascha Hauer <s.hauer@pengutronix.de>
+Date: Mon, 30 Jun 2014 11:07:25 +0200
+Subject: [PATCH 10/12] mmc: Add SDIO function devicetree subnode parsing
+
+This adds SDIO devicetree subnode parsing to the mmc core. While
+SDIO devices are runtime probable they sometimes need nonprobable
+additional information on embedded systems, like an additional gpio
+interrupt or a clock. This patch makes it possible to supply this
+information from the devicetree. SDIO drivers will find a pointer
+to the devicenode in their devices of_node pointer.
+
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+[hdegoede@redhat.com: Misc. cleanups]
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+---
+ drivers/mmc/core/bus.c      |    4 ++++
+ drivers/mmc/core/core.c     |   28 ++++++++++++++++++++++++++++
+ drivers/mmc/core/core.h     |    3 +++
+ drivers/mmc/core/sdio_bus.c |   11 +++++++++++
+ 4 files changed, 46 insertions(+)
+
+diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
+index e219c97..af6ec34 100644
+--- a/drivers/mmc/core/bus.c
++++ b/drivers/mmc/core/bus.c
+@@ -16,6 +16,7 @@
+ #include <linux/err.h>
+ #include <linux/slab.h>
+ #include <linux/stat.h>
++#include <linux/of.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/mmc/card.h>
+@@ -323,6 +324,8 @@ int mmc_add_card(struct mmc_card *card)
+ #endif
+       mmc_init_context_info(card->host);
++      card->dev.of_node = mmc_of_find_child_device(card->host, 0);
++
+       ret = device_add(&card->dev);
+       if (ret)
+               return ret;
+@@ -351,6 +354,7 @@ void mmc_remove_card(struct mmc_card *card)
+                               mmc_hostname(card->host), card->rca);
+               }
+               device_del(&card->dev);
++              of_node_put(card->dev.of_node);
+       }
+       put_device(&card->dev);
+diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
+index 5a46488..b14373c 100644
+--- a/drivers/mmc/core/core.c
++++ b/drivers/mmc/core/core.c
+@@ -1155,6 +1155,34 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max)
+ }
+ EXPORT_SYMBOL(mmc_vddrange_to_ocrmask);
++static int mmc_of_get_func_num(struct device_node *node)
++{
++      u32 reg;
++      int ret;
++
++      ret = of_property_read_u32(node, "reg", &reg);
++      if (ret < 0)
++              return ret;
++
++      return reg;
++}
++
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num)
++{
++      struct device_node *node;
++
++      if (!host->parent || !host->parent->of_node)
++              return NULL;
++
++      for_each_child_of_node(host->parent->of_node, node) {
++              if (mmc_of_get_func_num(node) == func_num)
++                      return node;
++      }
++
++      return NULL;
++}
++
+ #ifdef CONFIG_REGULATOR
+ /**
+diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
+index b9f18a2..6b01037 100644
+--- a/drivers/mmc/core/core.h
++++ b/drivers/mmc/core/core.h
+@@ -30,6 +30,9 @@ struct mmc_bus_ops {
+ void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
+ void mmc_detach_bus(struct mmc_host *host);
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num);
++
+ void mmc_init_erase(struct mmc_card *card);
+ void mmc_set_chip_select(struct mmc_host *host, int mode);
+diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
+index 546c67c..7a403db 100644
+--- a/drivers/mmc/core/sdio_bus.c
++++ b/drivers/mmc/core/sdio_bus.c
+@@ -21,7 +21,9 @@
+ #include <linux/mmc/card.h>
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sdio_func.h>
++#include <linux/of.h>
++#include "core.h"
+ #include "sdio_cis.h"
+ #include "sdio_bus.h"
+@@ -312,6 +314,13 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
+ static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
+ #endif
++static void sdio_set_of_node(struct sdio_func *func)
++{
++      struct mmc_host *host = func->card->host;
++
++      func->dev.of_node = mmc_of_find_child_device(host, func->num);
++}
++
+ /*
+  * Register a new SDIO function with the driver model.
+  */
+@@ -321,6 +330,7 @@ int sdio_add_func(struct sdio_func *func)
+       dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
++      sdio_set_of_node(func);
+       sdio_acpi_set_handle(func);
+       ret = device_add(&func->dev);
+       if (ret == 0) {
+@@ -344,6 +354,7 @@ void sdio_remove_func(struct sdio_func *func)
+       acpi_dev_pm_detach(&func->dev, false);
+       device_del(&func->dev);
++      of_node_put(func->dev.of_node);
+       put_device(&func->dev);
+ }
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53/0011-imx6q-sabresd-update-wilink8-entries-for-r8.6.patch b/patches/kernel_patches/imx-3.10.53/0011-imx6q-sabresd-update-wilink8-entries-for-r8.6.patch
new file mode 100644 (file)
index 0000000..4395537
--- /dev/null
@@ -0,0 +1,42 @@
+From 5a91c217ed9d81206eea9bd90f5db2e9b8d7fe92 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 12 Aug 2015 14:53:33 +0300
+Subject: [PATCH 11/12] imx6q-sabresd: update wilink8 entries for r8.6
+
+Due to changes in upstream there are a couple of device tree related
+parameters that are needed for wilink8 initialization that have changed
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl-sabresd.dtsi |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+index 57b468a..ce87714 100644
+--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+@@ -9,6 +9,7 @@
+  * http://www.opensource.org/licenses/gpl-license.html
+  * http://www.gnu.org/copyleft/gpl.html
+  */
++#include <dt-bindings/interrupt-controller/irq.h>
+ / {
+       aliases {
+@@ -677,11 +678,10 @@
+       #address-cells = <1>;
+       #size-cells = <0>;
+       wlcore: wlcore@0 {
+-              compatible = "ti,wlcore";
++              compatible = "ti,wl1835";
+               reg = <2>;
+               interrupt-parent = <&gpio4>;
+-              interrupts = <6 0>;
+-              platform-quirks = <1>;
++              interrupts = <6 IRQ_TYPE_EDGE_RISING>;
+       };
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.10.53/0012-imx6sl-evk-update-wilink8-entries-for-r8.6.patch b/patches/kernel_patches/imx-3.10.53/0012-imx6sl-evk-update-wilink8-entries-for-r8.6.patch
new file mode 100644 (file)
index 0000000..7440203
--- /dev/null
@@ -0,0 +1,41 @@
+From 4cca6cf5aa5a2a7567bc18d27127557f2a737c0f Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 12 Aug 2015 14:53:58 +0300
+Subject: [PATCH 12/12] imx6sl-evk: update wilink8 entries for r8.6
+
+Due to changes in upstream there are a couple of device tree related
+parameters that are needed for wilink8 initialization that have changed
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6sl-evk-common.dtsi |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6sl-evk-common.dtsi b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+index 1e7f7ce..a797743 100644
+--- a/arch/arm/boot/dts/imx6sl-evk-common.dtsi
++++ b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+@@ -5,6 +5,7 @@
+  * it under the terms of the GNU General Public License version 2 as
+  * published by the Free Software Foundation.
+  */
++#include <dt-bindings/interrupt-controller/irq.h>
+ / {
+       memory {
+@@ -521,10 +522,9 @@
+       #address-cells = <1>;
+       #size-cells = <0>;
+       wlcore: wlcore@0 {
+-              compatible = "ti,wlcore";
++              compatible = "ti,wl1835";
+               reg = <2>;
+               interrupt-parent = <&gpio5>;
+-              interrupts = <8 0>;
+-              platform-quirks = <1>;
++              interrupts = <8 IRQ_TYPE_EDGE_RISING>;
+       };
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch b/patches/kernel_patches/imx-3.14.28/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch
new file mode 100644 (file)
index 0000000..9b5ee5f
--- /dev/null
@@ -0,0 +1,135 @@
+From f57332f808ac5648c29a86f97a92610dc1199f14 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 4 Mar 2015 14:08:59 +0200
+Subject: [PATCH 01/10] imx6q-sabresd: add support for wilink8 wlan and
+ bluetooth
+
+* enable uart5 used for bluetooth with wilink8 with flow control
+* configure SD2 to be used for sdio communication to wilink8 wlan
+* configure gpios used for wlan/bt enables and wlan_irq
+* setup voltage regulator used for wl8 wlan power control
+* disable SPI1 as it pins are routed to J13 for connecting to wilink8
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+ [ Adapted for R8.6 ]
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl-sabresd.dtsi |   56 ++++++++++++++++++++++++++++++--
+ 1 file changed, 53 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+index 9cf7652..b9f60a4 100644
+--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+@@ -11,6 +11,7 @@
+  */
+ #include <dt-bindings/input/input.h>
++#include <dt-bindings/interrupt-controller/irq.h>
+ / {
+       aliases {
+@@ -241,6 +242,32 @@
+               reset-delay-us = <50>;
+               #reset-cells = <0>;
+       };
++
++      wlan_en_reg: fixedregulator@2 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++
++              /* WLAN_EN GPIO for this board – Bank4, pin7 */
++              gpio = <&gpio4 7 0>;
++
++              /* WLAN card specific delay */
++              startup-delay-us = <70000>;
++              enable-active-high;
++      };
++
++      kim {
++              compatible = "kim";
++              nshutdown_gpio = <2>;  /* GPIO_2 */
++              dev_name = "/dev/ttymxc4";
++              flow_cntrl = <1>;
++              baud_rate = <3000000>;
++      };
++
++      btwilink {
++              compatible = "btwilink";
++      };
+ };
+ &audmux {
+@@ -254,6 +281,7 @@
+       soc-supply = <&sw1c_reg>;
+ };
++/* the spi pins (inctrl_ecspi1_2) are used for connecting to WL8 using J13 so we disable it
+ &ecspi1 {
+       fsl,spi-num-chipselects = <1>;
+       cs-gpios = <&gpio4 9 0>;
+@@ -269,6 +297,7 @@
+               reg = <0>;
+       };
+ };
++*/
+ &fec {
+       pinctrl-names = "default";
+@@ -547,6 +576,8 @@
+                               MX6QDL_PAD_GPIO_1__WDOG2_B 0x80000000
+                               MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000
+                               MX6QDL_PAD_NANDF_CS1__GPIO6_IO14 0x80000000
++                              MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x13059 // reserve two pins wl8 gpio, this is pulled low at reset for WL_EN
++                              MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x13059 // this is for WL_IRQ which driver will configure as an input with a pull down
+                       >;
+               };
+@@ -899,6 +930,15 @@
+       status = "okay";
+ };
++&uart5 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&pinctrl_uart5_1>;
++      status = "okay";
++
++      /* enable rts/cts usage on uart5 */
++      fsl,uart-has-rtscts;
++};
++
+ &usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+@@ -915,13 +955,23 @@
+ &usdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+-      bus-width = <8>;
+-      cd-gpios = <&gpio2 2 0>;
+-      wp-gpios = <&gpio2 3 0>;
++      bus-width = <4>;
+       no-1-8-v;
+       keep-power-in-suspend;
+       enable-sdio-wakeup;
++      vmmc-supply = <&wlan_en_reg>;
++      non-removable;    /* non-removable is not a variable, the fact it is */
++                        /* listed is all that is used by driver  */
++      cap-power-off-card;
+       status = "okay";
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio4>;
++              interrupts = <6 IRQ_TYPE_EDGE_RISING>;
++      };
+ };
+ &usdhc3 {
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0002-Bluetooth-Add-tty-HCI-driver.patch b/patches/kernel_patches/imx-3.14.28/0002-Bluetooth-Add-tty-HCI-driver.patch
new file mode 100644 (file)
index 0000000..a33f41e
--- /dev/null
@@ -0,0 +1,603 @@
+From 295cc59ba886386f07b0760df245381deafc3098 Mon Sep 17 00:00:00 2001
+From: Pavan Savoy <pavan_savoy@ti.com>
+Date: Mon, 15 Oct 2012 17:47:35 -0500
+Subject: [PATCH 02/10] Bluetooth: Add tty HCI driver
+
+tty_hci driver exposes a /dev/hci_tty character device node, that intends to
+emulate a generic /dev/ttyX device that would be used by the user-space
+Bluetooth stacks to send/receive data to/from the WL combo-connectivity
+chipsets.
+
+The device driver has no internal logic of its own to intrepret data & all
+such logic is handled by the user-space stack.
+
+Change-Id: Ifa3860bbc7e252af210fde710bce14143239b552
+Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
+ [Fixed checkpatch warnings]
+Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
+ [Fixed checkpatch --strict warnings]
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/Kconfig   |    8 +
+ drivers/misc/ti-st/Makefile  |    1 +
+ drivers/misc/ti-st/tty_hci.c |  542 ++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 551 insertions(+)
+ create mode 100644 drivers/misc/ti-st/tty_hci.c
+
+diff --git a/drivers/misc/ti-st/Kconfig b/drivers/misc/ti-st/Kconfig
+index f34dcc5..f2df2c7 100644
+--- a/drivers/misc/ti-st/Kconfig
++++ b/drivers/misc/ti-st/Kconfig
+@@ -14,4 +14,12 @@ config TI_ST
+         are returned to relevant protocol drivers based on their
+         packet types.
++config ST_HCI
++      tristate "HCI TTY emulation driver for Bluetooth"
++      depends on TI_ST
++      help
++        This enables the TTY device like emulation for HCI used by
++        user-space Bluetooth stacks.
++        It will provide a character device for user space Bluetooth stack to
++        send/receive data over shared transport.
+ endmenu
+diff --git a/drivers/misc/ti-st/Makefile b/drivers/misc/ti-st/Makefile
+index 78d7ebb..4546219 100644
+--- a/drivers/misc/ti-st/Makefile
++++ b/drivers/misc/ti-st/Makefile
+@@ -4,3 +4,4 @@
+ #
+ obj-$(CONFIG_TI_ST)           += st_drv.o
+ st_drv-objs                   := st_core.o st_kim.o st_ll.o
++obj-$(CONFIG_ST_HCI)          += tty_hci.o
+diff --git a/drivers/misc/ti-st/tty_hci.c b/drivers/misc/ti-st/tty_hci.c
+new file mode 100644
+index 0000000..5b27b04
+--- /dev/null
++++ b/drivers/misc/ti-st/tty_hci.c
+@@ -0,0 +1,542 @@
++/*
++ *  TTY emulation for user-space Bluetooth stacks over HCI-H4
++ *  Copyright (C) 2011-2012 Texas Instruments
++ *  Author: Pavan Savoy <pavan_savoy@ti.com>
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License version 2 as
++ *  published by the Free Software Foundation.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ */
++
++/** define one of the following for debugging
++#define DEBUG
++#define VERBOSE
++*/
++
++#define pr_fmt(fmt) "(hci_tty): " fmt
++#include <linux/module.h>
++#include <linux/cdev.h>
++#include <linux/fs.h>
++#include <linux/device.h>
++
++#include <linux/uaccess.h>
++#include <linux/tty.h>
++#include <linux/sched.h>
++
++#include <linux/delay.h>
++#include <linux/firmware.h>
++#include <linux/platform_device.h>
++#include <linux/poll.h>
++#include <linux/skbuff.h>
++#include <linux/interrupt.h>
++
++#include <linux/ti_wilink_st.h>
++
++/* Number of seconds to wait for registration completion
++ * when ST returns PENDING status.
++ */
++#define BT_REGISTER_TIMEOUT   6000    /* 6 sec */
++
++/**
++ * struct ti_st - driver operation structure
++ * @hdev: hci device pointer which binds to bt driver
++ * @reg_status: ST registration callback status
++ * @st_write: write function provided by the ST driver
++ *    to be used by the driver during send_frame.
++ * @wait_reg_completion - completion sync between ti_st_open
++ *    and st_reg_completion_cb.
++ */
++struct ti_st {
++      struct hci_dev *hdev;
++      char reg_status;
++      long (*st_write)(struct sk_buff *);
++      struct completion wait_reg_completion;
++      wait_queue_head_t data_q;
++      struct sk_buff_head rx_list;
++};
++
++#define DEVICE_NAME     "hci_tty"
++
++/***********Functions called from ST driver**********************************/
++/* Called by Shared Transport layer when receive data is
++ * available */
++static long st_receive(void *priv_data, struct sk_buff *skb)
++{
++      struct ti_st    *hst = (void *)priv_data;
++
++      pr_debug("@ %s", __func__);
++#ifdef VERBOSE
++      print_hex_dump(KERN_INFO, ">rx>", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, skb->len, 0);
++#endif
++      skb_queue_tail(&hst->rx_list, skb);
++      wake_up_interruptible(&hst->data_q);
++      return 0;
++}
++
++/* Called by ST layer to indicate protocol registration completion
++ * status.ti_st_open() function will wait for signal from this
++ * API when st_register() function returns ST_PENDING.
++ */
++static void st_reg_completion_cb(void *priv_data, char data)
++{
++      struct ti_st    *lhst = (void *)priv_data;
++
++      pr_info("@ %s\n", __func__);
++      /* Save registration status for use in ti_st_open() */
++      lhst->reg_status = data;
++      /* complete the wait in ti_st_open() */
++      complete(&lhst->wait_reg_completion);
++}
++
++/* protocol structure registered with shared transport */
++#define MAX_BT_CHNL_IDS 3
++static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = {
++      {
++              .chnl_id = 0x04, /* HCI Events */
++              .hdr_len = 2,
++              .offset_len_in_hdr = 1,
++              .len_size = 1, /* sizeof(plen) in struct hci_event_hdr */
++              .reserve = 8,
++      },
++      {
++              .chnl_id = 0x02, /* ACL */
++              .hdr_len = 4,
++              .offset_len_in_hdr = 2,
++              .len_size = 2,  /* sizeof(dlen) in struct hci_acl_hdr */
++              .reserve = 8,
++      },
++      {
++              .chnl_id = 0x03, /* SCO */
++              .hdr_len = 3,
++              .offset_len_in_hdr = 2,
++              .len_size = 1, /* sizeof(dlen) in struct hci_sco_hdr */
++              .reserve = 8,
++      },
++};
++/** hci_tty_open Function
++ *  This function will perform an register on ST driver.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @inod  :
++ *  Returns  0 -  on success
++ *           else suitable error code
++ */
++int hci_tty_open(struct inode *inod, struct file *file)
++{
++      int i = 0, err = 0;
++      unsigned long timeleft;
++      struct ti_st *hst;
++
++      pr_info("inside %s (%p, %p)\n", __func__, inod, file);
++
++      hst = kzalloc(sizeof(*hst), GFP_KERNEL);
++      file->private_data = hst;
++      hst = file->private_data;
++
++      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++              ti_st_proto[i].priv_data = hst;
++              ti_st_proto[i].max_frame_size = 1026;
++              ti_st_proto[i].recv = st_receive;
++              ti_st_proto[i].reg_complete_cb = st_reg_completion_cb;
++
++              /* Prepare wait-for-completion handler */
++              init_completion(&hst->wait_reg_completion);
++              /* Reset ST registration callback status flag,
++               * this value will be updated in
++               * st_reg_completion_cb()
++               * function whenever it called from ST driver.
++               */
++              hst->reg_status = -EINPROGRESS;
++
++              err = st_register(&ti_st_proto[i]);
++              if (!err)
++                      goto done;
++
++              if (err != -EINPROGRESS) {
++                      pr_err("st_register failed %d", err);
++                      goto error;
++              }
++
++              /* ST is busy with either protocol
++               * registration or firmware download.
++               */
++              pr_debug("waiting for registration completion signal from ST");
++              timeleft = wait_for_completion_timeout
++                      (&hst->wait_reg_completion,
++                       msecs_to_jiffies(BT_REGISTER_TIMEOUT));
++              if (!timeleft) {
++                      pr_err("Timeout(%d sec),didn't get reg completion signal from ST",
++                             BT_REGISTER_TIMEOUT / 1000);
++                      err = -ETIMEDOUT;
++                      goto error;
++              }
++
++              /* Is ST registration callback
++               * called with ERROR status? */
++              if (hst->reg_status != 0) {
++                      pr_err("ST registration completed with invalid status %d",
++                             hst->reg_status);
++                      err = -EAGAIN;
++                      goto error;
++              }
++
++done:
++              hst->st_write = ti_st_proto[i].write;
++              if (!hst->st_write) {
++                      pr_err("undefined ST write function");
++                      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++                              /* Undo registration with ST */
++                              err = st_unregister(&ti_st_proto[i]);
++                              if (err)
++                                      pr_err("st_unregister() failed with error %d",
++                                             err);
++                              hst->st_write = NULL;
++                      }
++                      return -EIO;
++              }
++      }
++
++      skb_queue_head_init(&hst->rx_list);
++      init_waitqueue_head(&hst->data_q);
++
++      return 0;
++
++error:
++      kfree(hst);
++      return err;
++}
++
++/** hci_tty_release Function
++ *  This function will un-registers from the ST driver.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @inod  :
++ *  Returns  0 -  on success
++ *           else suitable error code
++ */
++int hci_tty_release(struct inode *inod, struct file *file)
++{
++      int err, i;
++      struct ti_st *hst = file->private_data;
++
++      pr_info("inside %s (%p, %p)\n", __func__, inod, file);
++
++      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++              err = st_unregister(&ti_st_proto[i]);
++              if (err)
++                      pr_err("st_unregister(%d) failed with error %d",
++                             ti_st_proto[i].chnl_id, err);
++      }
++
++      hst->st_write = NULL;
++      skb_queue_purge(&hst->rx_list);
++      kfree(hst);
++      return err;
++}
++
++/** hci_tty_read Function
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @data  : Data which needs to be passed to APP
++ *  @size  : Length of the data passesd
++ *  offset :
++ *  Returns  Size of packet received -  on success
++ *           else suitable error code
++ */
++ssize_t hci_tty_read(struct file *file, char __user *data, size_t size,
++              loff_t *offset)
++{
++      int len = 0, tout;
++      struct sk_buff *skb = NULL, *rskb = NULL;
++      struct ti_st    *hst;
++
++      pr_debug("inside %s (%p, %p, %u, %p)\n",
++               __func__, file, data, size, offset);
++
++      /* Validate input parameters */
++      if ((NULL == file) || (((NULL == data) || (0 == size)))) {
++              pr_err("Invalid input params passed to %s", __func__);
++              return -EINVAL;
++      }
++
++      hst = file->private_data;
++
++      /* cannot come here if poll-ed before reading
++       * if not poll-ed wait on the same wait_q
++       */
++      tout = wait_event_interruptible_timeout(hst->data_q,
++                      !skb_queue_empty(&hst->rx_list),
++                              msecs_to_jiffies(1000));
++      /* Check for timed out condition */
++      if (0 == tout) {
++              pr_err("Device Read timed out\n");
++              return -ETIMEDOUT;
++      }
++
++      /* hst->rx_list not empty skb already present */
++      skb = skb_dequeue(&hst->rx_list);
++      if (!skb) {
++              pr_err("dequed skb is null?\n");
++              return -EIO;
++      }
++
++#ifdef VERBOSE
++      print_hex_dump(KERN_INFO, ">in>", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, skb->len, 0);
++#endif
++
++      /* Forward the data to the user */
++      if (skb->len >= size) {
++              pr_err("FIONREAD not done before read\n");
++              return -ENOMEM;
++      } else {
++              /* returning skb */
++              rskb = alloc_skb(size, GFP_KERNEL);
++              if (!rskb) {
++                      pr_err("alloc_skb error\n");
++                      return -ENOMEM;
++              }
++
++              /* cb[0] has the pkt_type 0x04 or 0x02 or 0x03 */
++              memcpy(skb_put(rskb, 1), &skb->cb[0], 1);
++              memcpy(skb_put(rskb, skb->len), skb->data, skb->len);
++
++              if (copy_to_user(data, rskb->data, rskb->len)) {
++                      pr_err("unable to copy to user space\n");
++                      /* Queue the skb back to head */
++                      skb_queue_head(&hst->rx_list, skb);
++                      kfree_skb(rskb);
++                      return -EIO;
++              }
++      }
++
++      len = rskb->len;        /* len of returning skb */
++      kfree_skb(skb);
++      kfree_skb(rskb);
++      pr_debug("total size read= %d\n", len);
++      return len;
++}
++
++/* hci_tty_write Function
++ *
++ *  Parameters :
++ *  @file   : File pointer for BT char driver
++ *  @data   : packet data from BT application
++ *  @size   : Size of the packet data
++ *  @offset :
++ *  Returns  Size of packet on success
++ *           else suitable error code
++ */
++ssize_t hci_tty_write(struct file *file, const char __user *data,
++              size_t size, loff_t *offset)
++{
++      struct ti_st *hst = file->private_data;
++      struct  sk_buff *skb;
++
++      pr_debug("inside %s (%p, %p, %u, %p)\n",
++               __func__, file, data, size, offset);
++
++      if (!hst->st_write) {
++              pr_err(" Can't write to ST, hhci_tty->st_write null ?");
++              return -EINVAL;
++      }
++
++      skb = alloc_skb(size, GFP_KERNEL);
++      /* Validate Created SKB */
++      if (NULL == skb) {
++              pr_err("Error aaloacting SKB");
++              return -ENOMEM;
++      }
++
++      /* Forward the data from the user space to ST core */
++      if (copy_from_user(skb_put(skb, size), data, size)) {
++              pr_err(" Unable to copy from user space");
++              kfree_skb(skb);
++              return -EIO;
++      }
++
++#ifdef VERBOSE
++      pr_debug("start data..");
++      print_hex_dump(KERN_INFO, "<out<", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, size, 0);
++      pr_debug("\n..end data");
++#endif
++
++      hst->st_write(skb);
++      return size;
++}
++
++/** hci_tty_ioctl Function
++ *  This will peform the functions as directed by the command and command
++ *  argument.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @cmd   : IOCTL Command
++ *  @arg   : Command argument for IOCTL command
++ *  Returns  0 on success
++ *           else suitable error code
++ */
++static long hci_tty_ioctl(struct file *file,
++              unsigned int cmd, unsigned long arg)
++{
++      struct sk_buff *skb = NULL;
++      int             retcode = 0;
++      struct ti_st    *hst;
++
++      pr_debug("inside %s (%p, %u, %lx)", __func__, file, cmd, arg);
++
++      /* Validate input parameters */
++      if ((NULL == file) || (0 == cmd)) {
++              pr_err("invalid input parameters passed to %s", __func__);
++              return -EINVAL;
++      }
++
++      hst = file->private_data;
++
++      switch (cmd) {
++      case FIONREAD:
++              /* Deque the SKB from the head if rx_list is not empty
++               * update the argument with skb->len to provide amount of data
++               * available in the available SKB +1 for the PKT_TYPE
++               * field not provided in data by TI-ST.
++               */
++              skb = skb_dequeue(&hst->rx_list);
++              if (skb != NULL) {
++                      *(unsigned int *)arg = skb->len + 1;
++                      /* Re-Store the SKB for furtur Read operations */
++                      skb_queue_head(&hst->rx_list, skb);
++              } else {
++                      *(unsigned int *)arg = 0;
++              }
++              pr_debug("returning %d\n", *(unsigned int *)arg);
++              break;
++      default:
++              pr_debug("Un-Identified IOCTL %d", cmd);
++              retcode = 0;
++              break;
++      }
++
++      return retcode;
++}
++
++/** hci_tty_poll Function
++ *  This function will wait till some data is received to the hci_tty driver from ST
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @wait  : POLL wait information
++ *  Returns  status of POLL on success
++ *           else suitable error code
++ */
++static unsigned int hci_tty_poll(struct file *file, poll_table *wait)
++{
++      struct ti_st    *hst = file->private_data;
++      unsigned long mask = 0;
++
++      pr_debug("@ %s\n", __func__);
++
++      /* wait to be completed by st_receive */
++      poll_wait(file, &hst->data_q, wait);
++      pr_debug("poll broke\n");
++
++      if (!skb_queue_empty(&hst->rx_list)) {
++              pr_debug("rx list que !empty\n");
++              mask |= POLLIN; /* TODO: check app for mask */
++      }
++
++      return mask;
++}
++
++/* BT Char driver function pointers
++ * These functions are called from USER space by pefroming File Operations
++ * on /dev/hci_tty node exposed by this driver during init
++ */
++const struct file_operations hci_tty_chrdev_ops = {
++      .owner = THIS_MODULE,
++      .open = hci_tty_open,
++      .read = hci_tty_read,
++      .write = hci_tty_write,
++      .unlocked_ioctl = hci_tty_ioctl,
++      .poll = hci_tty_poll,
++      .release = hci_tty_release,
++};
++
++/*********Functions called during insmod and delmod****************************/
++
++static int hci_tty_major;             /* major number */
++static struct class *hci_tty_class;   /* class during class_create */
++static struct device *hci_tty_dev;    /* dev during device_create */
++/** hci_tty_init Function
++ *  This function Initializes the hci_tty driver parametes and exposes
++ *  /dev/hci_tty node to user space
++ *
++ *  Parameters : NULL
++ *  Returns  0 on success
++ *           else suitable error code
++ */
++static int __init hci_tty_init(void)
++{
++      pr_info("inside %s\n", __func__);
++
++      /* Expose the device DEVICE_NAME to user space
++       * And obtain the major number for the device
++       */
++      hci_tty_major = register_chrdev(0, DEVICE_NAME, &hci_tty_chrdev_ops);
++
++      if (0 > hci_tty_major) {
++              pr_err("Error when registering to char dev");
++              return hci_tty_major;
++      }
++
++      /*  udev */
++      hci_tty_class = class_create(THIS_MODULE, DEVICE_NAME);
++      if (IS_ERR(hci_tty_class)) {
++              pr_err("Something went wrong in class_create");
++              unregister_chrdev(hci_tty_major, DEVICE_NAME);
++              return -1;
++      }
++
++      hci_tty_dev =
++              device_create(hci_tty_class, NULL, MKDEV(hci_tty_major, 0),
++                            NULL, DEVICE_NAME);
++      if (IS_ERR(hci_tty_dev)) {
++              pr_err("Error in device create");
++              unregister_chrdev(hci_tty_major, DEVICE_NAME);
++              class_destroy(hci_tty_class);
++              return -1;
++      }
++      pr_info("allocated %d, %d\n", hci_tty_major, 0);
++      return 0;
++}
++
++/** hci_tty_exit Function
++ *  This function Destroys the hci_tty driver parametes and /dev/hci_tty node
++ *
++ *  Parameters : NULL
++ *  Returns   NULL
++ */
++static void __exit hci_tty_exit(void)
++{
++      pr_info("inside %s\n", __func__);
++      pr_info("bye.. freeing up %d\n", hci_tty_major);
++
++      device_destroy(hci_tty_class, MKDEV(hci_tty_major, 0));
++      class_destroy(hci_tty_class);
++      unregister_chrdev(hci_tty_major, DEVICE_NAME);
++}
++
++module_init(hci_tty_init);
++module_exit(hci_tty_exit);
++
++MODULE_AUTHOR("Pavan Savoy <pavan_savoy@ti.com>");
++MODULE_LICENSE("GPL");
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch b/patches/kernel_patches/imx-3.14.28/0003-imx_v7_defconfig-enable-Wilink8-related-switches.patch
new file mode 100644 (file)
index 0000000..62ec498
--- /dev/null
@@ -0,0 +1,69 @@
+From a767610868167f29fc2cb2ddc32551ae5136c9f7 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 4 Mar 2015 14:13:15 +0200
+Subject: [PATCH 03/10] imx_v7_defconfig: enable Wilink8 related switches
+
+* Disable internal mac80211 and cfg80211 as we are building wilink8
+  drivers using backport and loading as modules
+* enable wlan and hci related switches
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/configs/imx_v7_defconfig |   33 ++++++++++++++++++++++++++++++---
+ 1 file changed, 30 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
+index 303e679..fac8d07 100644
+--- a/arch/arm/configs/imx_v7_defconfig
++++ b/arch/arm/configs/imx_v7_defconfig
+@@ -81,8 +81,10 @@ CONFIG_BT_HCIUART_BCSP=y
+ CONFIG_BT_HCIUART_ATH3K=y
+ CONFIG_BT_HCIBCM203X=y
+ CONFIG_BT_ATH3K=y
+-CONFIG_CFG80211=y
+-CONFIG_MAC80211=y
++CONFIG_BT_HCIUART_LL=y
++CONFIG_BT_WILINK=y
++# CONFIG_CFG80211 is not set
++# CONFIG_MAC80211 is not set
+ CONFIG_DEVTMPFS=y
+ CONFIG_DEVTMPFS_MOUNT=y
+ # CONFIG_STANDALONE is not set
+@@ -406,8 +408,33 @@ CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=y
+ CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y
+ CONFIG_CRC_CCITT=m
+ CONFIG_CRC_T10DIF=y
+-CONFIG_CRC7=m
++CONFIG_CRC7=y
+ CONFIG_LIBCRC32C=m
+ CONFIG_FONTS=y
+ CONFIG_FONT_8x8=y
+ CONFIG_FONT_8x16=y
++#TI add for WL8
++CONFIG_WLAN=y
++CONFIG_CRYPTO_ARC4=y
++CONFIG_CRYPTO_AES=y
++CONFIG_NETFILTER=y
++CONFIG_NETFILTER_ADVANCED=y
++CONFIG_NF_CONNTRACK=y
++CONFIG_NETFILTER_XTABLES=y
++CONFIG_NF_DEFRAG_IPV4=y
++CONFIG_NF_CONNTRACK_IPV4=y
++CONFIG_NF_CONNTRACK_PROC_COMPAT=y
++CONFIG_IP_NF_IPTABLES=y
++CONFIG_IP_NF_FILTER=y
++CONFIG_IP_NF_TARGET_LOG=y
++CONFIG_NF_NAT=y
++CONFIG_NF_NAT_NEEDED=y
++CONFIG_IP_NF_TARGET_MASQUERADE=y
++CONFIG_INPUT_UINPUT=y
++CONFIG_AVERAGE=y
++CONFIG_PROC_DEVICETREE=y
++# enable dynamic debug for wl8
++CONFIG_DYNAMIC_DEBUG=y
++#enable ti shared transport support support
++CONFIG_TI_ST=y
++CONFIG_ST_HCI=y
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch b/patches/kernel_patches/imx-3.14.28/0004-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch
new file mode 100644 (file)
index 0000000..e37ae7c
--- /dev/null
@@ -0,0 +1,37 @@
+From 1e5151202500a121d34cc05e5a8f5d34ab752674 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 29 Jan 2014 09:24:06 +0200
+Subject: [PATCH 04/10] st_kim: do not use debugfs functions if not enabled
+
+the probe function was using debugfs apis without checking if
+CONFIG_DEBUG_FS was enabled resulting with runtime errors.
+Fix this so these apis will only be used if the switch is active.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index 9d3dbb2..3bab3e8 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -777,6 +777,7 @@ static int kim_probe(struct platform_device *pdev)
+       kim_gdata->baud_rate = pdata->baud_rate;
+       pr_info("sysfs entries created\n");
++#ifdef CONFIG_DEBUG_FS
+       kim_debugfs_dir = debugfs_create_dir("ti-st", NULL);
+       if (IS_ERR(kim_debugfs_dir)) {
+               pr_err(" debugfs entries creation failed ");
+@@ -793,6 +794,7 @@ static int kim_probe(struct platform_device *pdev)
+ err_debugfs_dir:
+       sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
++#endif
+ err_sysfs_group:
+       st_core_exit(kim_gdata->core_data);
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch b/patches/kernel_patches/imx-3.14.28/0005-st_kim-allow-suspend-if-callback-is-not-registered.patch
new file mode 100644 (file)
index 0000000..6038b24
--- /dev/null
@@ -0,0 +1,39 @@
+From 26c0aa5c37cd9ece6e7e17042877bb1a33a73af5 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 29 Jan 2014 09:03:41 +0200
+Subject: [PATCH 05/10] st_kim: allow suspend if callback is not registered
+
+Suspend/resume was failing if callbacks were not registered.
+As it is ok not to do anything when suspending fix this
+so it soen't return an error and allow the system to suspend.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index 3bab3e8..b373189 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -838,7 +838,7 @@ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+       if (pdata->suspend)
+               return pdata->suspend(pdev, state);
+-      return -EOPNOTSUPP;
++      return 0;
+ }
+ static int kim_resume(struct platform_device *pdev)
+@@ -848,7 +848,7 @@ static int kim_resume(struct platform_device *pdev)
+       if (pdata->resume)
+               return pdata->resume(pdev);
+-      return -EOPNOTSUPP;
++      return 0;
+ }
+ /**********************************************************************/
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0006-btwilink-add-minimal-device-tree-support.patch b/patches/kernel_patches/imx-3.14.28/0006-btwilink-add-minimal-device-tree-support.patch
new file mode 100644 (file)
index 0000000..a4e1364
--- /dev/null
@@ -0,0 +1,53 @@
+From af30fed5e764c514f2d7c13db883e34364e0a58f Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 23 May 2013 17:15:21 +0300
+Subject: [PATCH 06/10] btwilink: add minimal device tree support
+
+Add minimal device tree support to the btwilink driver that is used
+for binding bluetooth with the ti-st shared transport driver.
+
+Change-Id: I301c49d29046f20f8868bebb14347e82c12c8140
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: bvijay <bvijay@ti.com>
+---
+ drivers/bluetooth/btwilink.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
+index f038dba..95adec3 100644
+--- a/drivers/bluetooth/btwilink.c
++++ b/drivers/bluetooth/btwilink.c
+@@ -30,6 +30,7 @@
+ #include <linux/ti_wilink_st.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ /* Bluetooth Driver Version */
+ #define VERSION               "1.0"
+@@ -286,6 +287,14 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
+       return 0;
+ }
++static const struct of_device_id btwilink_of_match[] = {
++{
++      .compatible = "btwilink",
++      },
++      {}
++};
++MODULE_DEVICE_TABLE(of, btwilink_of_match);
++
+ static int bt_ti_probe(struct platform_device *pdev)
+ {
+       static struct ti_st *hst;
+@@ -350,6 +359,7 @@ static struct platform_driver btwilink_driver = {
+       .driver = {
+               .name = "btwilink",
+               .owner = THIS_MODULE,
++              .of_match_table = of_match_ptr(btwilink_of_match),
+       },
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0007-ti-st-add-device-tree-support.patch b/patches/kernel_patches/imx-3.14.28/0007-ti-st-add-device-tree-support.patch
new file mode 100644 (file)
index 0000000..7abc268
--- /dev/null
@@ -0,0 +1,255 @@
+From 356c02d3e36f53ca424e516f1d4855fb603997f1 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 23 May 2013 17:11:14 +0300
+Subject: [PATCH 07/10] ti-st: add device tree support
+
+When using device tree, driver configuration data need to be read from
+device node.
+Add support for getting the platform data information from the device
+tree information stored in the .dtb file in case it exists.
+
+Change-Id: I74f7f869fc257a057edb9f35c5fd8cbafb810164
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: bvijay <bvijay@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c  |   95 ++++++++++++++++++++++++++++++++++++++----
+ drivers/misc/ti-st/st_ll.c   |   17 +++++++-
+ include/linux/ti_wilink_st.h |    1 +
+ 3 files changed, 103 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index b373189..c0d59d8 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -36,7 +36,8 @@
+ #include <linux/skbuff.h>
+ #include <linux/ti_wilink_st.h>
+ #include <linux/module.h>
+-
++#include <linux/of.h>
++#include <linux/of_device.h>
+ #define MAX_ST_DEVICES        3       /* Imagine 1 on each UART for now */
+ static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
+@@ -44,6 +45,9 @@ static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
+ /**********************************************************************/
+ /* internal functions */
++struct ti_st_plat_data        *dt_pdata;
++static struct ti_st_plat_data *get_platform_data(struct device *dev);
++
+ /**
+  * st_get_plat_device -
+  *    function which returns the reference to the platform device
+@@ -461,7 +465,12 @@ long st_kim_start(void *kim_data)
+       struct kim_data_s       *kim_gdata = (struct kim_data_s *)kim_data;
+       pr_info(" %s", __func__);
+-      pdata = kim_gdata->kim_pdev->dev.platform_data;
++      if (kim_gdata->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_gdata->kim_pdev->dev.platform_data;
++      }
+       do {
+               /* platform specific enabling code here */
+@@ -521,12 +530,17 @@ long st_kim_stop(void *kim_data)
+ {
+       long err = 0;
+       struct kim_data_s       *kim_gdata = (struct kim_data_s *)kim_data;
+-      struct ti_st_plat_data  *pdata =
+-              kim_gdata->kim_pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       struct tty_struct       *tty = kim_gdata->core_data->tty;
+       reinit_completion(&kim_gdata->ldisc_installed);
++      if (kim_gdata->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else
++              pdata = kim_gdata->kim_pdev->dev.platform_data;
++
+       if (tty) {      /* can be called before ldisc is installed */
+               /* Flush any pending characters in the driver and discipline. */
+               tty_ldisc_flush(tty);
+@@ -714,13 +728,53 @@ static const struct file_operations list_debugfs_fops = {
+  * board-*.c file
+  */
++static const struct of_device_id kim_of_match[] = {
++{
++      .compatible = "kim",
++      },
++      {}
++};
++MODULE_DEVICE_TABLE(of, kim_of_match);
++
++static struct ti_st_plat_data *get_platform_data(struct device *dev)
++{
++      struct device_node *np = dev->of_node;
++      const u32 *dt_property;
++      int len;
++
++      dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
++
++      if (!dt_pdata)
++              pr_err("Can't allocate device_tree platform data\n");
++
++      dt_property = of_get_property(np, "dev_name", &len);
++      if (dt_property)
++              memcpy(&dt_pdata->dev_name, dt_property, len);
++      of_property_read_u32(np, "nshutdown_gpio",
++                           (u32 *)&dt_pdata->nshutdown_gpio);
++      of_property_read_u32(np, "flow_cntrl", (u32 *)&dt_pdata->flow_cntrl);
++      of_property_read_u32(np, "baud_rate", (u32 *)&dt_pdata->baud_rate);
++
++      return dt_pdata;
++}
++
+ static struct dentry *kim_debugfs_dir;
+ static int kim_probe(struct platform_device *pdev)
+ {
+       struct kim_data_s       *kim_gdata;
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       int err;
++      if (pdev->dev.of_node)
++              pdata = get_platform_data(&pdev->dev);
++      else
++              pdata = pdev->dev.platform_data;
++
++      if (pdata == NULL) {
++              dev_err(&pdev->dev, "Platform Data is missing\n");
++              return -ENXIO;
++      }
++
+       if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
+               /* multiple devices could exist */
+               st_kim_devices[pdev->id] = pdev;
+@@ -808,9 +862,16 @@ err_core_init:
+ static int kim_remove(struct platform_device *pdev)
+ {
+       /* free the GPIOs requested */
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       struct kim_data_s       *kim_gdata;
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
++
+       kim_gdata = platform_get_drvdata(pdev);
+       /* Free the Bluetooth/FM/GPIO
+@@ -828,12 +889,22 @@ static int kim_remove(struct platform_device *pdev)
+       kfree(kim_gdata);
+       kim_gdata = NULL;
++      kfree(dt_pdata);
++      dt_pdata = NULL;
++
+       return 0;
+ }
+ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+ {
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
++
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
+       if (pdata->suspend)
+               return pdata->suspend(pdev, state);
+@@ -843,7 +914,14 @@ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+ static int kim_resume(struct platform_device *pdev)
+ {
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
++
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
+       if (pdata->resume)
+               return pdata->resume(pdev);
+@@ -861,6 +939,7 @@ static struct platform_driver kim_platform_driver = {
+       .driver = {
+               .name = "kim",
+               .owner = THIS_MODULE,
++              .of_match_table = of_match_ptr(kim_of_match),
+       },
+ };
+diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
+index 93b4d67..518e1b7 100644
+--- a/drivers/misc/ti-st/st_ll.c
++++ b/drivers/misc/ti-st/st_ll.c
+@@ -26,6 +26,7 @@
+ #include <linux/ti_wilink_st.h>
+ /**********************************************************************/
++
+ /* internal functions */
+ static void send_ll_cmd(struct st_data_s *st_data,
+       unsigned char cmd)
+@@ -53,7 +54,13 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
+       /* communicate to platform about chip asleep */
+       kim_data = st_data->kim_data;
+-      pdata = kim_data->kim_pdev->dev.platform_data;
++      if (kim_data->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_data->kim_pdev->dev.platform_data;
++      }
++
+       if (pdata->chip_asleep)
+               pdata->chip_asleep(NULL);
+ }
+@@ -86,7 +93,13 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
+       /* communicate to platform about chip wakeup */
+       kim_data = st_data->kim_data;
+-      pdata = kim_data->kim_pdev->dev.platform_data;
++      if (kim_data->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_data->kim_pdev->dev.platform_data;
++      }
++
+       if (pdata->chip_awake)
+               pdata->chip_awake(NULL);
+ }
+diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
+index 932b763..39e577c 100644
+--- a/include/linux/ti_wilink_st.h
++++ b/include/linux/ti_wilink_st.h
+@@ -86,6 +86,7 @@ struct st_proto_s {
+ extern long st_register(struct st_proto_s *);
+ extern long st_unregister(struct st_proto_s *);
++extern struct ti_st_plat_data   *dt_pdata;
+ /*
+  * header information used by st_core.c
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch b/patches/kernel_patches/imx-3.14.28/0008-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch
new file mode 100644 (file)
index 0000000..8ca66e2
--- /dev/null
@@ -0,0 +1,180 @@
+From 43e6228120a2c4448e580a2a3e2bc986b2dabd71 Mon Sep 17 00:00:00 2001
+From: Alexey Berd <alexeyb@ti.com>
+Date: Thu, 11 Jun 2015 11:07:42 +0100
+Subject: [PATCH 08/10] imx6sl-evk: add support for wilink8 wlan and bluetooth
+
+* enable uart4 used for bluetooth with wilink8 with flow control
+* configure SD3 to be used for sdio communication to wilink8 wlan
+* configure gpios used for wlan/bt enables and wlan_irq
+* setup voltage regulator used for wl8 wlan power control
+* disable SD1 as it pins are used for BT/WLAN EN, IRQ, BT UART
+
+Signed-off-by: Alexey Berd <alexeyb@ti.com>
+ [Adapted for imx 3.14.26 kernel and R8.6]
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6sl-evk.dts |  102 +++++++++++++++++++-------------------
+ 1 file changed, 50 insertions(+), 52 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
+index e233a5c..5c829c3 100644
+--- a/arch/arm/boot/dts/imx6sl-evk.dts
++++ b/arch/arm/boot/dts/imx6sl-evk.dts
+@@ -9,6 +9,7 @@
+ /dts-v1/;
+ #include <dt-bindings/input/input.h>
++#include <dt-bindings/interrupt-controller/irq.h>
+ #include "imx6sl.dtsi"
+ / {
+@@ -32,6 +33,28 @@
+               reg = <0x80000000 0x40000000>;
+       };
++      wlan_en_reg: fixedregulator@2 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++              /* WLAN_EN GPIO for this board - Bank5, pin13 */
++              gpio = <&gpio5 13 0>;
++              enable-active-high;
++      };
++
++      kim {
++              compatible = "kim";
++              nshutdown_gpio = <134>;  // GPIO5_6 The wl8 driver expects gpio to be an integer, so gpio5_6 is (5-1)*32+6=134
++              dev_name = "/dev/ttymxc3";
++              flow_cntrl = <1>;
++              baud_rate = <3000000>;
++      };
++
++      btwilink {
++              compatible = "btwilink";
++      };
++
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+@@ -656,21 +679,13 @@
+               pinctrl_uart4_1: uart4grp-1 {
+                       fsl,pins = <
+-                              MX6SL_PAD_SD1_DAT4__UART4_RX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT5__UART4_TX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT7__UART4_CTS_B         0x1b0b1
+-                              MX6SL_PAD_SD1_DAT6__UART4_RTS_B         0x1b0b1
++                              MX6SL_PAD_SD1_DAT4__UART4_RX_DATA 0x13059 // used for HOST_HCI_RX
++                              MX6SL_PAD_SD1_DAT5__UART4_TX_DATA 0x13059 // used for HOST_HCI_TX
++                              MX6SL_PAD_SD1_DAT7__UART4_CTS_B 0x13059   // used for HOST_HCI_RTS, note reversed to TI nomenclature
++                              MX6SL_PAD_SD1_DAT6__UART4_RTS_B 0x13059   // used for HOST_HCI_CTS
+                       >;
+               };
+-              pinctrl_uart4dte_1: uart4dtegrp-1 {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD1_DAT5__UART4_RX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT4__UART4_TX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT6__UART4_CTS_B         0x1b0b1
+-                              MX6SL_PAD_SD1_DAT7__UART4_RTS_B         0x1b0b1
+-                      >;
+-              };
+               pinctrl_usbotg1: usbotg1grp {
+                       fsl,pins = <
+@@ -764,28 +779,8 @@
+                               MX6SL_PAD_SD3_DAT1__SD3_DATA1           0x17059
+                               MX6SL_PAD_SD3_DAT2__SD3_DATA2           0x17059
+                               MX6SL_PAD_SD3_DAT3__SD3_DATA3           0x17059
+-                      >;
+-              };
+-
+-              pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x170b9
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x100b9
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x170b9
+-                              MX6SL_PAD_SD3_DAT1__SD3_DATA1           0x170b9
+-                              MX6SL_PAD_SD3_DAT2__SD3_DATA2           0x170b9
+-                              MX6SL_PAD_SD3_DAT3__SD3_DATA3           0x170b9
+-                      >;
+-              };
+-
+-              pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x170f9
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x100f9
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x170f9
+-                              MX6SL_PAD_SD3_DAT1__SD3_DATA1           0x170f9
+-                              MX6SL_PAD_SD3_DAT2__SD3_DATA2           0x170f9
+-                              MX6SL_PAD_SD3_DAT3__SD3_DATA3           0x170f9
++                              MX6SL_PAD_SD1_DAT2__GPIO5_IO13  0x13059   // reserve two pins from sd1 for wl8 gpio, this is pulled low at reset for WL_EN
++                              MX6SL_PAD_SD1_DAT1__GPIO5_IO08  0x13059   // this is for wl_irq which driver will configure as an input with a pull down
+                       >;
+               };
+@@ -896,6 +891,13 @@
+       status = "okay";
+ };
++&uart4 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&pinctrl_uart4_1>;
++      status = "okay";
++      fsl,uart-has-rtscts;      // enable rts/cts usage on uart4
++};
++
+ &usbotg1 {
+       vbus-supply = <&reg_usb_otg1_vbus>;
+       pinctrl-names = "default";
+@@ -911,18 +913,6 @@
+       status = "okay";
+ };
+-&usdhc1 {
+-      pinctrl-names = "default", "state_100mhz", "state_200mhz";
+-      pinctrl-0 = <&pinctrl_usdhc1>;
+-      pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+-      pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+-      bus-width = <8>;
+-      cd-gpios = <&gpio4 7 0>;
+-      wp-gpios = <&gpio4 6 0>;
+-      keep-power-in-suspend;
+-      enable-sdio-wakeup;
+-      status = "okay";
+-};
+ &usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+@@ -936,13 +926,21 @@
+       status = "okay";
+ };
+-&usdhc3 {
+-      pinctrl-names = "default", "state_100mhz", "state_200mhz";
++ &usdhc3 {
++      pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+-      pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+-      pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+-      cd-gpios = <&gpio3 22 0>;
+       keep-power-in-suspend;
+       enable-sdio-wakeup;
++      vmmc-supply = <&wlan_en_reg>;
++      non-removable;    // non-removable is not a variable, the fact it is listed is all that is used by driver
++      cap-power-off-card;
+       status = "okay";
+-};
++      #address-cells = <1>;
++      #size-cells = <0>;
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio5>;
++              interrupts = <8 IRQ_TYPE_EDGE_RISING>;
++      };
++ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch b/patches/kernel_patches/imx-3.14.28/0009-imx6-decrease-wilink8-sdio-pins-drive-strength.patch
new file mode 100644 (file)
index 0000000..92b9a84
--- /dev/null
@@ -0,0 +1,64 @@
+From ec3df7f1ef02ab78657fdc019d325a49fb89b4a7 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 11 Jun 2015 11:27:49 +0100
+Subject: [PATCH 09/10] imx6: decrease wilink8 sdio pins drive strength
+
+The original drive strength value of 90 OHM was too strong causing
+detection issues of some modules on the sdio bus.
+Reducing the io strength to 50 OHM solves this issue
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl-sabresd.dtsi |   12 ++++++------
+ arch/arm/boot/dts/imx6sl-evk.dts       |   12 ++++++------
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+index b9f60a4..c95f849 100644
+--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+@@ -757,12 +757,12 @@
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <
+-                              MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17059
+-                              MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10059
+-                              MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17059
+-                              MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17059
+-                              MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17059
+-                              MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17059
++                              MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17069
++                              MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10069
++                              MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17069
++                              MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17069
++                              MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17069
++                              MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17069
+                               MX6QDL_PAD_NANDF_D4__SD2_DATA4          0x17059
+                               MX6QDL_PAD_NANDF_D5__SD2_DATA5          0x17059
+                               MX6QDL_PAD_NANDF_D6__SD2_DATA6          0x17059
+diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
+index 5c829c3..0b01cda 100644
+--- a/arch/arm/boot/dts/imx6sl-evk.dts
++++ b/arch/arm/boot/dts/imx6sl-evk.dts
+@@ -773,12 +773,12 @@
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x17059
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x10059
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x17059
+-                              MX6SL_PAD_SD3_DAT1__SD3_DATA1           0x17059
+-                              MX6SL_PAD_SD3_DAT2__SD3_DATA2           0x17059
+-                              MX6SL_PAD_SD3_DAT3__SD3_DATA3           0x17059
++                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x17069
++                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x10069
++                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x17069
++                              MX6SL_PAD_SD3_DAT1__SD3_DATA1           0x17069
++                              MX6SL_PAD_SD3_DAT2__SD3_DATA2           0x17069
++                              MX6SL_PAD_SD3_DAT3__SD3_DATA3           0x17069
+                               MX6SL_PAD_SD1_DAT2__GPIO5_IO13  0x13059   // reserve two pins from sd1 for wl8 gpio, this is pulled low at reset for WL_EN
+                               MX6SL_PAD_SD1_DAT1__GPIO5_IO08  0x13059   // this is for wl_irq which driver will configure as an input with a pull down
+                       >;
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch b/patches/kernel_patches/imx-3.14.28/0010-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch
new file mode 100644 (file)
index 0000000..9cf7ad4
--- /dev/null
@@ -0,0 +1,152 @@
+From f7411890987cd0d0bd33b2fc86ebe34bddd81847 Mon Sep 17 00:00:00 2001
+From: Sascha Hauer <s.hauer@pengutronix.de>
+Date: Mon, 30 Jun 2014 11:07:25 +0200
+Subject: [PATCH 10/10] mmc: Add SDIO function devicetree subnode parsing
+
+This adds SDIO devicetree subnode parsing to the mmc core. While
+SDIO devices are runtime probable they sometimes need nonprobable
+additional information on embedded systems, like an additional gpio
+interrupt or a clock. This patch makes it possible to supply this
+information from the devicetree. SDIO drivers will find a pointer
+to the devicenode in their devices of_node pointer.
+
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+[hdegoede@redhat.com: Misc. cleanups]
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+---
+ drivers/mmc/core/bus.c      |    4 ++++
+ drivers/mmc/core/core.c     |   28 ++++++++++++++++++++++++++++
+ drivers/mmc/core/core.h     |    3 +++
+ drivers/mmc/core/sdio_bus.c |   11 +++++++++++
+ 4 files changed, 46 insertions(+)
+
+diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
+index 64145a3..0c431a2 100644
+--- a/drivers/mmc/core/bus.c
++++ b/drivers/mmc/core/bus.c
+@@ -16,6 +16,7 @@
+ #include <linux/err.h>
+ #include <linux/slab.h>
+ #include <linux/stat.h>
++#include <linux/of.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/mmc/card.h>
+@@ -367,6 +368,8 @@ int mmc_add_card(struct mmc_card *card)
+ #endif
+       mmc_init_context_info(card->host);
++      card->dev.of_node = mmc_of_find_child_device(card->host, 0);
++
+       ret = device_add(&card->dev);
+       if (ret)
+               return ret;
+@@ -395,6 +398,7 @@ void mmc_remove_card(struct mmc_card *card)
+                               mmc_hostname(card->host), card->rca);
+               }
+               device_del(&card->dev);
++              of_node_put(card->dev.of_node);
+       }
+       put_device(&card->dev);
+diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
+index e65a857..769d7a9 100644
+--- a/drivers/mmc/core/core.c
++++ b/drivers/mmc/core/core.c
+@@ -1217,6 +1217,34 @@ EXPORT_SYMBOL(mmc_of_parse_voltage);
+ #endif /* CONFIG_OF */
++static int mmc_of_get_func_num(struct device_node *node)
++{
++      u32 reg;
++      int ret;
++
++      ret = of_property_read_u32(node, "reg", &reg);
++      if (ret < 0)
++              return ret;
++
++      return reg;
++}
++
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num)
++{
++      struct device_node *node;
++
++      if (!host->parent || !host->parent->of_node)
++              return NULL;
++
++      for_each_child_of_node(host->parent->of_node, node) {
++              if (mmc_of_get_func_num(node) == func_num)
++                      return node;
++      }
++
++      return NULL;
++}
++
+ #ifdef CONFIG_REGULATOR
+ /**
+diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
+index 443a584..f712f6e 100644
+--- a/drivers/mmc/core/core.h
++++ b/drivers/mmc/core/core.h
+@@ -32,6 +32,9 @@ struct mmc_bus_ops {
+ void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
+ void mmc_detach_bus(struct mmc_host *host);
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num);
++
+ void mmc_init_erase(struct mmc_card *card);
+ void mmc_set_chip_select(struct mmc_host *host, int mode);
+diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
+index 92d1ba8..35c23ae 100644
+--- a/drivers/mmc/core/sdio_bus.c
++++ b/drivers/mmc/core/sdio_bus.c
+@@ -21,7 +21,9 @@
+ #include <linux/mmc/card.h>
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sdio_func.h>
++#include <linux/of.h>
++#include "core.h"
+ #include "sdio_cis.h"
+ #include "sdio_bus.h"
+@@ -314,6 +316,13 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
+ static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
+ #endif
++static void sdio_set_of_node(struct sdio_func *func)
++{
++      struct mmc_host *host = func->card->host;
++
++      func->dev.of_node = mmc_of_find_child_device(host, func->num);
++}
++
+ /*
+  * Register a new SDIO function with the driver model.
+  */
+@@ -323,6 +332,7 @@ int sdio_add_func(struct sdio_func *func)
+       dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
++      sdio_set_of_node(func);
+       sdio_acpi_set_handle(func);
+       ret = device_add(&func->dev);
+       if (ret == 0) {
+@@ -346,6 +356,7 @@ void sdio_remove_func(struct sdio_func *func)
+       acpi_dev_pm_detach(&func->dev, false);
+       device_del(&func->dev);
++      of_node_put(func->dev.of_node);
+       put_device(&func->dev);
+ }
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.28/Readme.txt b/patches/kernel_patches/imx-3.14.28/Readme.txt
new file mode 100644 (file)
index 0000000..e301977
--- /dev/null
@@ -0,0 +1,8 @@
+Adding wilink8 support to the freescale imx6q-sabresd board
+===========================================================
+
+This patchset adds wilink8 support for the imx 3.14.28 kernel
+
+Kernel base tage used is "rel_imx_3.14.28_1.0.0_ga"
+
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0001-imx6q-sabresd-add-support-for-wilink8-wlan-and-bluet.patch
new file mode 100644 (file)
index 0000000..5e1e0a0
--- /dev/null
@@ -0,0 +1,169 @@
+From d701d954537a4440df692293ca8adac565c6f0c5 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 4 Mar 2015 14:08:59 +0200
+Subject: [PATCH 01/12] imx6q-sabresd: add support for wilink8 wlan and
+ bluetooth
+
+* enable uart5 used for bluetooth with wilink8 with flow control
+* configure SD2 to be used for sdio communication to wilink8 wlan
+* configure gpios used for wlan/bt enables and wlan_irq
+* setup voltage regulator used for wl8 wlan power control
+* disable SPI1 as it pins are routed to J13 for connecting to wilink8
+* remove gpio pin assigned to rfkill as rfkill is not used for
+  wl18xx bluetooth enable
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6qdl-sabresd.dtsi |   74 ++++++++++++++++++++++++--------
+ 1 file changed, 56 insertions(+), 18 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+index d39576b..4692560 100644
+--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+@@ -11,6 +11,7 @@
+  */
+ #include <dt-bindings/input/input.h>
++#include <dt-bindings/interrupt-controller/irq.h>
+ / {
+       aliases {
+@@ -20,6 +21,32 @@
+               mxcfb3 = &mxcfb4;
+       };
++      wlan_en_reg: fixedregulator@2 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++
++              /* WLAN_EN GPIO for this board – Bank4, pin7 */
++              gpio = <&gpio4 7 0>;
++
++              /* WLAN card specific delay */
++              startup-delay-us = <70000>;
++              enable-active-high;
++      };
++
++        kim {
++                compatible = "kim";
++                nshutdown_gpio = <2>;  /* GPIO_2 */
++                dev_name = "/dev/ttymxc4";
++                flow_cntrl = <1>;
++                baud_rate = <3000000>;
++        };
++
++        btwilink {
++                compatible = "btwilink";
++        };
++
+       battery: max8903@0 {
+               compatible = "fsl,max8903-charger";
+               pinctrl-names = "default";
+@@ -308,12 +335,6 @@
+               power-on-gpio = <&gpio3 19 0>;
+       };
+-    bt_rfkill {
+-                compatible = "fsl,mxc_bt_rfkill";
+-                        bt-power-gpios = <&gpio1 2 0>;
+-                                status ="okay";
+-    };
+-
+       ramoops_device {
+               compatible = "fsl,mxc_ramoops";
+               record_size = <524288>; /*512K*/
+@@ -372,6 +393,7 @@
+       fsl,ldb-di1-parent = <&clks IMX6QDL_CLK_PLL2_PFD0_352M>;
+ };
++/* the spi pins (inctrl_ecspi1_2) are used for connecting to WL8 using J13 so we disable it
+ &ecspi1 {
+       fsl,spi-num-chipselects = <1>;
+       cs-gpios = <&gpio4 9 0>;
+@@ -387,6 +409,7 @@
+               reg = <0>;
+       };
+ };
++*/
+ &fec {
+       pinctrl-names = "default";
+@@ -669,6 +692,7 @@
+                               MX6QDL_PAD_NANDF_CS1__GPIO6_IO14 0x80000000
+                               MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000
+                               MX6QDL_PAD_NANDF_CS3__GPIO6_IO16 0x80000000
++                              MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x13059 // this is for WL_IRQ which driver will configure as an input with a pull down
+                       >;
+               };
+@@ -848,12 +872,12 @@
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <
+-                              MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17059
+-                              MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10059
+-                              MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17059
+-                              MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17059
+-                              MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17059
+-                              MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17059
++                              MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17069
++                              MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10069
++                              MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17069
++                              MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17069
++                              MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17069
++                              MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17069
+                               MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x13069 /* WL_REG_ON */
+                       >;
+               };
+@@ -1019,10 +1043,13 @@
+ };
+ &uart5 {
+-    pinctrl-names = "default";
+-    pinctrl-0 = <&pinctrl_uart5_1>;
+-    fsl,uart-has-rtscts;
+-    status = "okay";
++      pinctrl-names = "default";
++      pinctrl-0 = <&pinctrl_uart5_1>;
++      fsl,uart-has-rtscts;
++      status = "okay";
++
++      /* enable rts/cts usage on uart5 */
++      fsl,uart-has-rtscts;
+ };
+ &usbh1 {
+@@ -1045,14 +1072,25 @@
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       bus-width = <4>;
+-      cd-gpios = <&gpio2 2 0>;
+-      wp-gpios = <&gpio2 3 0>;
+       no-1-8-v;
+       wifi-host;
+       pm-ignore-notify;
+       keep-power-in-suspend;
+       enable-sdio-wakeup;
++      vmmc-supply = <&wlan_en_reg>;
++      non-removable;    /* non-removable is not a variable, the fact it is */
++                        /* listed is all that is used by driver  */
++      cap-power-off-card;
++      #address-cells = <1>;
++      #size-cells = <0>;
+       status = "okay";
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio4>;
++              interrupts = <6 IRQ_TYPE_EDGE_RISING>;
++              platform-quirks = <1>;
++      };
+ };
+ &usdhc3 {
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0002-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0002-imx6sl-evk-add-support-for-wilink8-wlan-and-bluetoot.patch
new file mode 100644 (file)
index 0000000..b3fe9cf
--- /dev/null
@@ -0,0 +1,180 @@
+From d69f6aa48fa5b4c464a31549c2dbff80760a90cd Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 23 Mar 2015 13:14:06 +0200
+Subject: [PATCH 02/12] imx6sl-evk: add support for wilink8 wlan and bluetooth
+
+* enable uart4 used for bluetooth with wilink8 with flow control
+* configure SD3 to be used for sdio communication to wilink8 wlan
+* configure gpios used for wlan/bt enables and wlan_irq
+* setup voltage regulator used for wl8 wlan power control
+* disable SD1 as it pins are used for BT/WLAN EN, IRQ, BT UART
+
+Signed-off-by: Alexey Berd <alexeyb@ti.com>
+
+The original drive strength value of 90 OHM was too strong causing
+detection issues of some modules on the sdio bus.
+Reducing the io strength to 50 OHM solves this issue
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/boot/dts/imx6sl-evk.dts |  104 ++++++++++++++++++++------------------
+ 1 file changed, 56 insertions(+), 48 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
+index 36e26a5..848a658 100644
+--- a/arch/arm/boot/dts/imx6sl-evk.dts
++++ b/arch/arm/boot/dts/imx6sl-evk.dts
+@@ -9,12 +9,35 @@
+ /dts-v1/;
+ #include <dt-bindings/input/input.h>
++#include <dt-bindings/interrupt-controller/irq.h>
+ #include "imx6sl.dtsi"
+ / {
+       model = "Freescale i.MX6 SoloLite EVK Board";
+       compatible = "fsl,imx6sl-evk", "fsl,imx6sl";
++      wlan_en_reg: fixedregulator@2 {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <1800000>;
++              regulator-max-microvolt = <1800000>;
++              /* WLAN_EN GPIO for this board - Bank5, pin13 */
++              gpio = <&gpio5 13 0>;
++              enable-active-high;
++      };
++
++      kim {
++              compatible = "kim";
++              nshutdown_gpio = <134>;  // GPIO5_6 The wl8 driver expects gpio to be an integer, so gpio5_6 is (5-1)*32+6=134
++              dev_name = "/dev/ttymxc3";
++              flow_cntrl = <1>;
++              baud_rate = <3000000>;
++      };
++
++      btwilink {
++              compatible = "btwilink";
++      };
++
+       battery: max8903@0 {
+               compatible = "fsl,max8903-charger";
+               pinctrl-names = "default";
+@@ -707,19 +730,11 @@
+               pinctrl_uart4_1: uart4grp-1 {
+                       fsl,pins = <
+-                              MX6SL_PAD_SD1_DAT4__UART4_RX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT5__UART4_TX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT7__UART4_CTS_B         0x1b0b1
+-                              MX6SL_PAD_SD1_DAT6__UART4_RTS_B         0x1b0b1
+-                      >;
+-              };
+-
+-              pinctrl_uart4dte_1: uart4dtegrp-1 {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD1_DAT5__UART4_RX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT4__UART4_TX_DATA       0x1b0b1
+-                              MX6SL_PAD_SD1_DAT6__UART4_CTS_B         0x1b0b1
+-                              MX6SL_PAD_SD1_DAT7__UART4_RTS_B         0x1b0b1
++                              MX6SL_PAD_SD1_DAT4__UART4_RX_DATA 0x13059 // used for HOST_HCI_RX
++                              MX6SL_PAD_SD1_DAT5__UART4_TX_DATA 0x13059 // used for HOST_HCI_TX
++                              MX6SL_PAD_SD1_DAT7__UART4_CTS_B 0x13059   // used for HOST_HCI_RTS, note reversed to TI nomenclature
++                              MX6SL_PAD_SD1_DAT6__UART4_RTS_B 0x13059   // used for HOST_HCI_CTS
++                              MX6SL_PAD_SD1_DAT3__GPIO5_IO06  0x13059   // used for BT_EN
+                       >;
+               };
+@@ -806,25 +821,14 @@
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x17059
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x10059
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x17059
+-                      >;
+-              };
+-
+-              pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x170b9
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x100b9
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x170b9
+-                      >;
+-              };
+-
+-              pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+-                      fsl,pins = <
+-                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x170f9
+-                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x100f9
+-                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x170f9
++                              MX6SL_PAD_SD3_CMD__SD3_CMD              0x17069
++                              MX6SL_PAD_SD3_CLK__SD3_CLK              0x10069
++                              MX6SL_PAD_SD3_DAT0__SD3_DATA0           0x17069
++                              MX6SL_PAD_SD3_DAT1__SD3_DATA1           0x17069
++                              MX6SL_PAD_SD3_DAT2__SD3_DATA2           0x17069
++                              MX6SL_PAD_SD3_DAT3__SD3_DATA3           0x17069
++                              MX6SL_PAD_SD1_DAT2__GPIO5_IO13          0x13059   // reserve two pins from sd1 for wl8 gpio, this is pulled low at reset for WL_EN
++                              MX6SL_PAD_SD1_DAT1__GPIO5_IO08          0x13059   // this is for wl_irq which driver will configure as an input with a pull down
+                       >;
+               };
+@@ -935,6 +939,13 @@
+       status = "okay";
+ };
++&uart4 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&pinctrl_uart4_1>;
++      status = "okay";
++      fsl,uart-has-rtscts;      // enable rts/cts usage on uart4
++};
++
+ &usbotg1 {
+       vbus-supply = <&reg_usb_otg1_vbus>;
+       pinctrl-names = "default";
+@@ -953,21 +964,6 @@
+       status = "okay";
+ };
+-&usdhc1 {
+-      pinctrl-names = "default";
+-      pinctrl-0 = <&pinctrl_usdhc1>;
+-      pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+-      pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+-      bus-width = <4>;
+-      cd-gpios = <&gpio4 7 0>;
+-      wp-gpios = <&gpio4 6 0>;
+-      keep-power-in-suspend;
+-      enable-sdio-wakeup;
+-      wifi-host;
+-      pm-ignore-notify;
+-      status = "okay";
+-};
+-
+ &usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+@@ -983,6 +979,18 @@
+ &usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+-      bus-width = <1>;
++      keep-power-in-suspend;
++      enable-sdio-wakeup;
++      vmmc-supply = <&wlan_en_reg>;
++      non-removable;    // non-removable is not a variable, the fact it is listed is all that is used by driver
++      cap-power-off-card;
++      #address-cells = <1>;
++      #size-cells = <0>;
+       status = "okay";
++      wlcore: wlcore@0 {
++              compatible = "ti,wl1835";
++              reg = <2>;
++              interrupt-parent = <&gpio5>;
++              interrupts = <8 IRQ_TYPE_EDGE_RISING>;
++      };
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0003-Bluetooth-Add-tty-HCI-driver.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0003-Bluetooth-Add-tty-HCI-driver.patch
new file mode 100644 (file)
index 0000000..f2adf52
--- /dev/null
@@ -0,0 +1,603 @@
+From 4d7f933f7b14964ef78622830fbe88a83229850e Mon Sep 17 00:00:00 2001
+From: Pavan Savoy <pavan_savoy@ti.com>
+Date: Mon, 15 Oct 2012 17:47:35 -0500
+Subject: [PATCH 03/12] Bluetooth: Add tty HCI driver
+
+tty_hci driver exposes a /dev/hci_tty character device node, that intends to
+emulate a generic /dev/ttyX device that would be used by the user-space
+Bluetooth stacks to send/receive data to/from the WL combo-connectivity
+chipsets.
+
+The device driver has no internal logic of its own to intrepret data & all
+such logic is handled by the user-space stack.
+
+Change-Id: Ifa3860bbc7e252af210fde710bce14143239b552
+Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
+ [Fixed checkpatch warnings]
+Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
+ [Fixed checkpatch --strict warnings]
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/Kconfig   |    8 +
+ drivers/misc/ti-st/Makefile  |    1 +
+ drivers/misc/ti-st/tty_hci.c |  542 ++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 551 insertions(+)
+ create mode 100644 drivers/misc/ti-st/tty_hci.c
+
+diff --git a/drivers/misc/ti-st/Kconfig b/drivers/misc/ti-st/Kconfig
+index f34dcc5..f2df2c7 100644
+--- a/drivers/misc/ti-st/Kconfig
++++ b/drivers/misc/ti-st/Kconfig
+@@ -14,4 +14,12 @@ config TI_ST
+         are returned to relevant protocol drivers based on their
+         packet types.
++config ST_HCI
++      tristate "HCI TTY emulation driver for Bluetooth"
++      depends on TI_ST
++      help
++        This enables the TTY device like emulation for HCI used by
++        user-space Bluetooth stacks.
++        It will provide a character device for user space Bluetooth stack to
++        send/receive data over shared transport.
+ endmenu
+diff --git a/drivers/misc/ti-st/Makefile b/drivers/misc/ti-st/Makefile
+index 78d7ebb..4546219 100644
+--- a/drivers/misc/ti-st/Makefile
++++ b/drivers/misc/ti-st/Makefile
+@@ -4,3 +4,4 @@
+ #
+ obj-$(CONFIG_TI_ST)           += st_drv.o
+ st_drv-objs                   := st_core.o st_kim.o st_ll.o
++obj-$(CONFIG_ST_HCI)          += tty_hci.o
+diff --git a/drivers/misc/ti-st/tty_hci.c b/drivers/misc/ti-st/tty_hci.c
+new file mode 100644
+index 0000000..5b27b04
+--- /dev/null
++++ b/drivers/misc/ti-st/tty_hci.c
+@@ -0,0 +1,542 @@
++/*
++ *  TTY emulation for user-space Bluetooth stacks over HCI-H4
++ *  Copyright (C) 2011-2012 Texas Instruments
++ *  Author: Pavan Savoy <pavan_savoy@ti.com>
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License version 2 as
++ *  published by the Free Software Foundation.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ */
++
++/** define one of the following for debugging
++#define DEBUG
++#define VERBOSE
++*/
++
++#define pr_fmt(fmt) "(hci_tty): " fmt
++#include <linux/module.h>
++#include <linux/cdev.h>
++#include <linux/fs.h>
++#include <linux/device.h>
++
++#include <linux/uaccess.h>
++#include <linux/tty.h>
++#include <linux/sched.h>
++
++#include <linux/delay.h>
++#include <linux/firmware.h>
++#include <linux/platform_device.h>
++#include <linux/poll.h>
++#include <linux/skbuff.h>
++#include <linux/interrupt.h>
++
++#include <linux/ti_wilink_st.h>
++
++/* Number of seconds to wait for registration completion
++ * when ST returns PENDING status.
++ */
++#define BT_REGISTER_TIMEOUT   6000    /* 6 sec */
++
++/**
++ * struct ti_st - driver operation structure
++ * @hdev: hci device pointer which binds to bt driver
++ * @reg_status: ST registration callback status
++ * @st_write: write function provided by the ST driver
++ *    to be used by the driver during send_frame.
++ * @wait_reg_completion - completion sync between ti_st_open
++ *    and st_reg_completion_cb.
++ */
++struct ti_st {
++      struct hci_dev *hdev;
++      char reg_status;
++      long (*st_write)(struct sk_buff *);
++      struct completion wait_reg_completion;
++      wait_queue_head_t data_q;
++      struct sk_buff_head rx_list;
++};
++
++#define DEVICE_NAME     "hci_tty"
++
++/***********Functions called from ST driver**********************************/
++/* Called by Shared Transport layer when receive data is
++ * available */
++static long st_receive(void *priv_data, struct sk_buff *skb)
++{
++      struct ti_st    *hst = (void *)priv_data;
++
++      pr_debug("@ %s", __func__);
++#ifdef VERBOSE
++      print_hex_dump(KERN_INFO, ">rx>", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, skb->len, 0);
++#endif
++      skb_queue_tail(&hst->rx_list, skb);
++      wake_up_interruptible(&hst->data_q);
++      return 0;
++}
++
++/* Called by ST layer to indicate protocol registration completion
++ * status.ti_st_open() function will wait for signal from this
++ * API when st_register() function returns ST_PENDING.
++ */
++static void st_reg_completion_cb(void *priv_data, char data)
++{
++      struct ti_st    *lhst = (void *)priv_data;
++
++      pr_info("@ %s\n", __func__);
++      /* Save registration status for use in ti_st_open() */
++      lhst->reg_status = data;
++      /* complete the wait in ti_st_open() */
++      complete(&lhst->wait_reg_completion);
++}
++
++/* protocol structure registered with shared transport */
++#define MAX_BT_CHNL_IDS 3
++static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = {
++      {
++              .chnl_id = 0x04, /* HCI Events */
++              .hdr_len = 2,
++              .offset_len_in_hdr = 1,
++              .len_size = 1, /* sizeof(plen) in struct hci_event_hdr */
++              .reserve = 8,
++      },
++      {
++              .chnl_id = 0x02, /* ACL */
++              .hdr_len = 4,
++              .offset_len_in_hdr = 2,
++              .len_size = 2,  /* sizeof(dlen) in struct hci_acl_hdr */
++              .reserve = 8,
++      },
++      {
++              .chnl_id = 0x03, /* SCO */
++              .hdr_len = 3,
++              .offset_len_in_hdr = 2,
++              .len_size = 1, /* sizeof(dlen) in struct hci_sco_hdr */
++              .reserve = 8,
++      },
++};
++/** hci_tty_open Function
++ *  This function will perform an register on ST driver.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @inod  :
++ *  Returns  0 -  on success
++ *           else suitable error code
++ */
++int hci_tty_open(struct inode *inod, struct file *file)
++{
++      int i = 0, err = 0;
++      unsigned long timeleft;
++      struct ti_st *hst;
++
++      pr_info("inside %s (%p, %p)\n", __func__, inod, file);
++
++      hst = kzalloc(sizeof(*hst), GFP_KERNEL);
++      file->private_data = hst;
++      hst = file->private_data;
++
++      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++              ti_st_proto[i].priv_data = hst;
++              ti_st_proto[i].max_frame_size = 1026;
++              ti_st_proto[i].recv = st_receive;
++              ti_st_proto[i].reg_complete_cb = st_reg_completion_cb;
++
++              /* Prepare wait-for-completion handler */
++              init_completion(&hst->wait_reg_completion);
++              /* Reset ST registration callback status flag,
++               * this value will be updated in
++               * st_reg_completion_cb()
++               * function whenever it called from ST driver.
++               */
++              hst->reg_status = -EINPROGRESS;
++
++              err = st_register(&ti_st_proto[i]);
++              if (!err)
++                      goto done;
++
++              if (err != -EINPROGRESS) {
++                      pr_err("st_register failed %d", err);
++                      goto error;
++              }
++
++              /* ST is busy with either protocol
++               * registration or firmware download.
++               */
++              pr_debug("waiting for registration completion signal from ST");
++              timeleft = wait_for_completion_timeout
++                      (&hst->wait_reg_completion,
++                       msecs_to_jiffies(BT_REGISTER_TIMEOUT));
++              if (!timeleft) {
++                      pr_err("Timeout(%d sec),didn't get reg completion signal from ST",
++                             BT_REGISTER_TIMEOUT / 1000);
++                      err = -ETIMEDOUT;
++                      goto error;
++              }
++
++              /* Is ST registration callback
++               * called with ERROR status? */
++              if (hst->reg_status != 0) {
++                      pr_err("ST registration completed with invalid status %d",
++                             hst->reg_status);
++                      err = -EAGAIN;
++                      goto error;
++              }
++
++done:
++              hst->st_write = ti_st_proto[i].write;
++              if (!hst->st_write) {
++                      pr_err("undefined ST write function");
++                      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++                              /* Undo registration with ST */
++                              err = st_unregister(&ti_st_proto[i]);
++                              if (err)
++                                      pr_err("st_unregister() failed with error %d",
++                                             err);
++                              hst->st_write = NULL;
++                      }
++                      return -EIO;
++              }
++      }
++
++      skb_queue_head_init(&hst->rx_list);
++      init_waitqueue_head(&hst->data_q);
++
++      return 0;
++
++error:
++      kfree(hst);
++      return err;
++}
++
++/** hci_tty_release Function
++ *  This function will un-registers from the ST driver.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @inod  :
++ *  Returns  0 -  on success
++ *           else suitable error code
++ */
++int hci_tty_release(struct inode *inod, struct file *file)
++{
++      int err, i;
++      struct ti_st *hst = file->private_data;
++
++      pr_info("inside %s (%p, %p)\n", __func__, inod, file);
++
++      for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
++              err = st_unregister(&ti_st_proto[i]);
++              if (err)
++                      pr_err("st_unregister(%d) failed with error %d",
++                             ti_st_proto[i].chnl_id, err);
++      }
++
++      hst->st_write = NULL;
++      skb_queue_purge(&hst->rx_list);
++      kfree(hst);
++      return err;
++}
++
++/** hci_tty_read Function
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @data  : Data which needs to be passed to APP
++ *  @size  : Length of the data passesd
++ *  offset :
++ *  Returns  Size of packet received -  on success
++ *           else suitable error code
++ */
++ssize_t hci_tty_read(struct file *file, char __user *data, size_t size,
++              loff_t *offset)
++{
++      int len = 0, tout;
++      struct sk_buff *skb = NULL, *rskb = NULL;
++      struct ti_st    *hst;
++
++      pr_debug("inside %s (%p, %p, %u, %p)\n",
++               __func__, file, data, size, offset);
++
++      /* Validate input parameters */
++      if ((NULL == file) || (((NULL == data) || (0 == size)))) {
++              pr_err("Invalid input params passed to %s", __func__);
++              return -EINVAL;
++      }
++
++      hst = file->private_data;
++
++      /* cannot come here if poll-ed before reading
++       * if not poll-ed wait on the same wait_q
++       */
++      tout = wait_event_interruptible_timeout(hst->data_q,
++                      !skb_queue_empty(&hst->rx_list),
++                              msecs_to_jiffies(1000));
++      /* Check for timed out condition */
++      if (0 == tout) {
++              pr_err("Device Read timed out\n");
++              return -ETIMEDOUT;
++      }
++
++      /* hst->rx_list not empty skb already present */
++      skb = skb_dequeue(&hst->rx_list);
++      if (!skb) {
++              pr_err("dequed skb is null?\n");
++              return -EIO;
++      }
++
++#ifdef VERBOSE
++      print_hex_dump(KERN_INFO, ">in>", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, skb->len, 0);
++#endif
++
++      /* Forward the data to the user */
++      if (skb->len >= size) {
++              pr_err("FIONREAD not done before read\n");
++              return -ENOMEM;
++      } else {
++              /* returning skb */
++              rskb = alloc_skb(size, GFP_KERNEL);
++              if (!rskb) {
++                      pr_err("alloc_skb error\n");
++                      return -ENOMEM;
++              }
++
++              /* cb[0] has the pkt_type 0x04 or 0x02 or 0x03 */
++              memcpy(skb_put(rskb, 1), &skb->cb[0], 1);
++              memcpy(skb_put(rskb, skb->len), skb->data, skb->len);
++
++              if (copy_to_user(data, rskb->data, rskb->len)) {
++                      pr_err("unable to copy to user space\n");
++                      /* Queue the skb back to head */
++                      skb_queue_head(&hst->rx_list, skb);
++                      kfree_skb(rskb);
++                      return -EIO;
++              }
++      }
++
++      len = rskb->len;        /* len of returning skb */
++      kfree_skb(skb);
++      kfree_skb(rskb);
++      pr_debug("total size read= %d\n", len);
++      return len;
++}
++
++/* hci_tty_write Function
++ *
++ *  Parameters :
++ *  @file   : File pointer for BT char driver
++ *  @data   : packet data from BT application
++ *  @size   : Size of the packet data
++ *  @offset :
++ *  Returns  Size of packet on success
++ *           else suitable error code
++ */
++ssize_t hci_tty_write(struct file *file, const char __user *data,
++              size_t size, loff_t *offset)
++{
++      struct ti_st *hst = file->private_data;
++      struct  sk_buff *skb;
++
++      pr_debug("inside %s (%p, %p, %u, %p)\n",
++               __func__, file, data, size, offset);
++
++      if (!hst->st_write) {
++              pr_err(" Can't write to ST, hhci_tty->st_write null ?");
++              return -EINVAL;
++      }
++
++      skb = alloc_skb(size, GFP_KERNEL);
++      /* Validate Created SKB */
++      if (NULL == skb) {
++              pr_err("Error aaloacting SKB");
++              return -ENOMEM;
++      }
++
++      /* Forward the data from the user space to ST core */
++      if (copy_from_user(skb_put(skb, size), data, size)) {
++              pr_err(" Unable to copy from user space");
++              kfree_skb(skb);
++              return -EIO;
++      }
++
++#ifdef VERBOSE
++      pr_debug("start data..");
++      print_hex_dump(KERN_INFO, "<out<", DUMP_PREFIX_NONE,
++                     16, 1, skb->data, size, 0);
++      pr_debug("\n..end data");
++#endif
++
++      hst->st_write(skb);
++      return size;
++}
++
++/** hci_tty_ioctl Function
++ *  This will peform the functions as directed by the command and command
++ *  argument.
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @cmd   : IOCTL Command
++ *  @arg   : Command argument for IOCTL command
++ *  Returns  0 on success
++ *           else suitable error code
++ */
++static long hci_tty_ioctl(struct file *file,
++              unsigned int cmd, unsigned long arg)
++{
++      struct sk_buff *skb = NULL;
++      int             retcode = 0;
++      struct ti_st    *hst;
++
++      pr_debug("inside %s (%p, %u, %lx)", __func__, file, cmd, arg);
++
++      /* Validate input parameters */
++      if ((NULL == file) || (0 == cmd)) {
++              pr_err("invalid input parameters passed to %s", __func__);
++              return -EINVAL;
++      }
++
++      hst = file->private_data;
++
++      switch (cmd) {
++      case FIONREAD:
++              /* Deque the SKB from the head if rx_list is not empty
++               * update the argument with skb->len to provide amount of data
++               * available in the available SKB +1 for the PKT_TYPE
++               * field not provided in data by TI-ST.
++               */
++              skb = skb_dequeue(&hst->rx_list);
++              if (skb != NULL) {
++                      *(unsigned int *)arg = skb->len + 1;
++                      /* Re-Store the SKB for furtur Read operations */
++                      skb_queue_head(&hst->rx_list, skb);
++              } else {
++                      *(unsigned int *)arg = 0;
++              }
++              pr_debug("returning %d\n", *(unsigned int *)arg);
++              break;
++      default:
++              pr_debug("Un-Identified IOCTL %d", cmd);
++              retcode = 0;
++              break;
++      }
++
++      return retcode;
++}
++
++/** hci_tty_poll Function
++ *  This function will wait till some data is received to the hci_tty driver from ST
++ *
++ *  Parameters :
++ *  @file  : File pointer for BT char driver
++ *  @wait  : POLL wait information
++ *  Returns  status of POLL on success
++ *           else suitable error code
++ */
++static unsigned int hci_tty_poll(struct file *file, poll_table *wait)
++{
++      struct ti_st    *hst = file->private_data;
++      unsigned long mask = 0;
++
++      pr_debug("@ %s\n", __func__);
++
++      /* wait to be completed by st_receive */
++      poll_wait(file, &hst->data_q, wait);
++      pr_debug("poll broke\n");
++
++      if (!skb_queue_empty(&hst->rx_list)) {
++              pr_debug("rx list que !empty\n");
++              mask |= POLLIN; /* TODO: check app for mask */
++      }
++
++      return mask;
++}
++
++/* BT Char driver function pointers
++ * These functions are called from USER space by pefroming File Operations
++ * on /dev/hci_tty node exposed by this driver during init
++ */
++const struct file_operations hci_tty_chrdev_ops = {
++      .owner = THIS_MODULE,
++      .open = hci_tty_open,
++      .read = hci_tty_read,
++      .write = hci_tty_write,
++      .unlocked_ioctl = hci_tty_ioctl,
++      .poll = hci_tty_poll,
++      .release = hci_tty_release,
++};
++
++/*********Functions called during insmod and delmod****************************/
++
++static int hci_tty_major;             /* major number */
++static struct class *hci_tty_class;   /* class during class_create */
++static struct device *hci_tty_dev;    /* dev during device_create */
++/** hci_tty_init Function
++ *  This function Initializes the hci_tty driver parametes and exposes
++ *  /dev/hci_tty node to user space
++ *
++ *  Parameters : NULL
++ *  Returns  0 on success
++ *           else suitable error code
++ */
++static int __init hci_tty_init(void)
++{
++      pr_info("inside %s\n", __func__);
++
++      /* Expose the device DEVICE_NAME to user space
++       * And obtain the major number for the device
++       */
++      hci_tty_major = register_chrdev(0, DEVICE_NAME, &hci_tty_chrdev_ops);
++
++      if (0 > hci_tty_major) {
++              pr_err("Error when registering to char dev");
++              return hci_tty_major;
++      }
++
++      /*  udev */
++      hci_tty_class = class_create(THIS_MODULE, DEVICE_NAME);
++      if (IS_ERR(hci_tty_class)) {
++              pr_err("Something went wrong in class_create");
++              unregister_chrdev(hci_tty_major, DEVICE_NAME);
++              return -1;
++      }
++
++      hci_tty_dev =
++              device_create(hci_tty_class, NULL, MKDEV(hci_tty_major, 0),
++                            NULL, DEVICE_NAME);
++      if (IS_ERR(hci_tty_dev)) {
++              pr_err("Error in device create");
++              unregister_chrdev(hci_tty_major, DEVICE_NAME);
++              class_destroy(hci_tty_class);
++              return -1;
++      }
++      pr_info("allocated %d, %d\n", hci_tty_major, 0);
++      return 0;
++}
++
++/** hci_tty_exit Function
++ *  This function Destroys the hci_tty driver parametes and /dev/hci_tty node
++ *
++ *  Parameters : NULL
++ *  Returns   NULL
++ */
++static void __exit hci_tty_exit(void)
++{
++      pr_info("inside %s\n", __func__);
++      pr_info("bye.. freeing up %d\n", hci_tty_major);
++
++      device_destroy(hci_tty_class, MKDEV(hci_tty_major, 0));
++      class_destroy(hci_tty_class);
++      unregister_chrdev(hci_tty_major, DEVICE_NAME);
++}
++
++module_init(hci_tty_init);
++module_exit(hci_tty_exit);
++
++MODULE_AUTHOR("Pavan Savoy <pavan_savoy@ti.com>");
++MODULE_LICENSE("GPL");
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0004-imx_v7_defconfig-enable-Wilink8-related-switches.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0004-imx_v7_defconfig-enable-Wilink8-related-switches.patch
new file mode 100644 (file)
index 0000000..1bce99d
--- /dev/null
@@ -0,0 +1,64 @@
+From f76b4fff5475cdf62c6ebbece39585c556dc3de4 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 4 Mar 2015 14:13:15 +0200
+Subject: [PATCH 04/12] imx_v7_defconfig: enable Wilink8 related switches
+
+* Disable internal mac80211 and cfg80211 as we are building wilink8
+  drivers using backport and loading as modules
+* enable wlan and hci related switches
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/configs/imx_v7_defconfig |   28 +++++++++++++++++++++++++++-
+ 1 file changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
+index e3315f3..b3c06a0 100644
+--- a/arch/arm/configs/imx_v7_defconfig
++++ b/arch/arm/configs/imx_v7_defconfig
+@@ -79,6 +79,7 @@ CONFIG_BT_BNEP=y
+ CONFIG_BT_BNEP_MC_FILTER=y
+ CONFIG_BT_BNEP_PROTO_FILTER=y
+ CONFIG_BT_HIDP=y
++CONFIG_BT_WILINK=y
+ CONFIG_BT_HCIBTUSB=y
+ CONFIG_BT_HCIUART=y
+ CONFIG_BT_HCIUART_H4=y
+@@ -440,8 +441,33 @@ CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=y
+ CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y
+ CONFIG_CRC_CCITT=m
+ CONFIG_CRC_T10DIF=y
+-CONFIG_CRC7=m
++CONFIG_CRC7=y
+ CONFIG_LIBCRC32C=m
+ CONFIG_FONTS=y
+ CONFIG_FONT_8x8=y
+ CONFIG_FONT_8x16=y
++#TI add for WL8
++CONFIG_WLAN=y
++CONFIG_CRYPTO_ARC4=y
++CONFIG_CRYPTO_AES=y
++CONFIG_NETFILTER=y
++CONFIG_NETFILTER_ADVANCED=y
++CONFIG_NF_CONNTRACK=y
++CONFIG_NETFILTER_XTABLES=y
++CONFIG_NF_DEFRAG_IPV4=y
++CONFIG_NF_CONNTRACK_IPV4=y
++CONFIG_NF_CONNTRACK_PROC_COMPAT=y
++CONFIG_IP_NF_IPTABLES=y
++CONFIG_IP_NF_FILTER=y
++CONFIG_IP_NF_TARGET_LOG=y
++CONFIG_NF_NAT=y
++CONFIG_NF_NAT_NEEDED=y
++CONFIG_IP_NF_TARGET_MASQUERADE=y
++CONFIG_INPUT_UINPUT=y
++CONFIG_AVERAGE=y
++CONFIG_PROC_DEVICETREE=y
++# enable dynamic debug for wl8
++CONFIG_DYNAMIC_DEBUG=y
++#enable ti shared transport support support
++CONFIG_TI_ST=y
++CONFIG_ST_HCI=y
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0005-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0005-st_kim-do-not-use-debugfs-functions-if-not-enabled.patch
new file mode 100644 (file)
index 0000000..f0ef663
--- /dev/null
@@ -0,0 +1,37 @@
+From b28edc7ef40cefedfdb209ce301a46af49438163 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 29 Jan 2014 09:24:06 +0200
+Subject: [PATCH 05/12] st_kim: do not use debugfs functions if not enabled
+
+the probe function was using debugfs apis without checking if
+CONFIG_DEBUG_FS was enabled resulting with runtime errors.
+Fix this so these apis will only be used if the switch is active.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index 9d3dbb2..3bab3e8 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -777,6 +777,7 @@ static int kim_probe(struct platform_device *pdev)
+       kim_gdata->baud_rate = pdata->baud_rate;
+       pr_info("sysfs entries created\n");
++#ifdef CONFIG_DEBUG_FS
+       kim_debugfs_dir = debugfs_create_dir("ti-st", NULL);
+       if (IS_ERR(kim_debugfs_dir)) {
+               pr_err(" debugfs entries creation failed ");
+@@ -793,6 +794,7 @@ static int kim_probe(struct platform_device *pdev)
+ err_debugfs_dir:
+       sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
++#endif
+ err_sysfs_group:
+       st_core_exit(kim_gdata->core_data);
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0006-st_kim-allow-suspend-if-callback-is-not-registered.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0006-st_kim-allow-suspend-if-callback-is-not-registered.patch
new file mode 100644 (file)
index 0000000..0bb4fa4
--- /dev/null
@@ -0,0 +1,39 @@
+From 099e637e86592daca9a7b2705770a1db9ee52dcf Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 29 Jan 2014 09:03:41 +0200
+Subject: [PATCH 06/12] st_kim: allow suspend if callback is not registered
+
+Suspend/resume was failing if callbacks were not registered.
+As it is ok not to do anything when suspending fix this
+so it soen't return an error and allow the system to suspend.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index 3bab3e8..b373189 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -838,7 +838,7 @@ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+       if (pdata->suspend)
+               return pdata->suspend(pdev, state);
+-      return -EOPNOTSUPP;
++      return 0;
+ }
+ static int kim_resume(struct platform_device *pdev)
+@@ -848,7 +848,7 @@ static int kim_resume(struct platform_device *pdev)
+       if (pdata->resume)
+               return pdata->resume(pdev);
+-      return -EOPNOTSUPP;
++      return 0;
+ }
+ /**********************************************************************/
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0007-btwilink-add-minimal-device-tree-support.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0007-btwilink-add-minimal-device-tree-support.patch
new file mode 100644 (file)
index 0000000..07f80d6
--- /dev/null
@@ -0,0 +1,53 @@
+From 3e525176d7d2d6fe90abfa558fea58c40d06aa83 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 23 May 2013 17:15:21 +0300
+Subject: [PATCH 07/12] btwilink: add minimal device tree support
+
+Add minimal device tree support to the btwilink driver that is used
+for binding bluetooth with the ti-st shared transport driver.
+
+Change-Id: I301c49d29046f20f8868bebb14347e82c12c8140
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: bvijay <bvijay@ti.com>
+---
+ drivers/bluetooth/btwilink.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
+index f038dba..95adec3 100644
+--- a/drivers/bluetooth/btwilink.c
++++ b/drivers/bluetooth/btwilink.c
+@@ -30,6 +30,7 @@
+ #include <linux/ti_wilink_st.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ /* Bluetooth Driver Version */
+ #define VERSION               "1.0"
+@@ -286,6 +287,14 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
+       return 0;
+ }
++static const struct of_device_id btwilink_of_match[] = {
++{
++      .compatible = "btwilink",
++      },
++      {}
++};
++MODULE_DEVICE_TABLE(of, btwilink_of_match);
++
+ static int bt_ti_probe(struct platform_device *pdev)
+ {
+       static struct ti_st *hst;
+@@ -350,6 +359,7 @@ static struct platform_driver btwilink_driver = {
+       .driver = {
+               .name = "btwilink",
+               .owner = THIS_MODULE,
++              .of_match_table = of_match_ptr(btwilink_of_match),
+       },
+ };
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0008-ti-st-add-device-tree-support.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0008-ti-st-add-device-tree-support.patch
new file mode 100644 (file)
index 0000000..594e3b8
--- /dev/null
@@ -0,0 +1,256 @@
+From 7eefbc3c43fee208545e8733e53d1207a87106d7 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 23 May 2013 17:11:14 +0300
+Subject: [PATCH 08/12] ti-st: add device tree support
+
+When using device tree, driver configuration data need to be read from
+device node.
+Add support for getting the platform data information from the device
+tree information stored in the .dtb file in case it exists.
+
+Change-Id: I74f7f869fc257a057edb9f35c5fd8cbafb810164
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: bvijay <bvijay@ti.com>
+---
+ drivers/misc/ti-st/st_kim.c  |   96 ++++++++++++++++++++++++++++++++++++++----
+ drivers/misc/ti-st/st_ll.c   |   17 +++++++-
+ include/linux/ti_wilink_st.h |    1 +
+ 3 files changed, 104 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index b373189..e3471e7 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -36,7 +36,8 @@
+ #include <linux/skbuff.h>
+ #include <linux/ti_wilink_st.h>
+ #include <linux/module.h>
+-
++#include <linux/of.h>
++#include <linux/of_device.h>
+ #define MAX_ST_DEVICES        3       /* Imagine 1 on each UART for now */
+ static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
+@@ -44,6 +45,9 @@ static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
+ /**********************************************************************/
+ /* internal functions */
++struct ti_st_plat_data        *dt_pdata;
++static struct ti_st_plat_data *get_platform_data(struct device *dev);
++
+ /**
+  * st_get_plat_device -
+  *    function which returns the reference to the platform device
+@@ -461,7 +465,12 @@ long st_kim_start(void *kim_data)
+       struct kim_data_s       *kim_gdata = (struct kim_data_s *)kim_data;
+       pr_info(" %s", __func__);
+-      pdata = kim_gdata->kim_pdev->dev.platform_data;
++      if (kim_gdata->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_gdata->kim_pdev->dev.platform_data;
++      }
+       do {
+               /* platform specific enabling code here */
+@@ -521,12 +530,18 @@ long st_kim_stop(void *kim_data)
+ {
+       long err = 0;
+       struct kim_data_s       *kim_gdata = (struct kim_data_s *)kim_data;
+-      struct ti_st_plat_data  *pdata =
+-              kim_gdata->kim_pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       struct tty_struct       *tty = kim_gdata->core_data->tty;
+       reinit_completion(&kim_gdata->ldisc_installed);
++      if (kim_gdata->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else
++              pdata = kim_gdata->kim_pdev->dev.platform_data;
++
++
+       if (tty) {      /* can be called before ldisc is installed */
+               /* Flush any pending characters in the driver and discipline. */
+               tty_ldisc_flush(tty);
+@@ -714,13 +729,53 @@ static const struct file_operations list_debugfs_fops = {
+  * board-*.c file
+  */
++static const struct of_device_id kim_of_match[] = {
++{
++      .compatible = "kim",
++      },
++      {}
++};
++MODULE_DEVICE_TABLE(of, kim_of_match);
++
++static struct ti_st_plat_data *get_platform_data(struct device *dev)
++{
++      struct device_node *np = dev->of_node;
++      const u32 *dt_property;
++      int len;
++
++      dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
++
++      if (!dt_pdata)
++              pr_err("Can't allocate device_tree platform data\n");
++
++      dt_property = of_get_property(np, "dev_name", &len);
++      if (dt_property)
++              memcpy(&dt_pdata->dev_name, dt_property, len);
++      of_property_read_u32(np, "nshutdown_gpio",
++                           (u32 *)&dt_pdata->nshutdown_gpio);
++      of_property_read_u32(np, "flow_cntrl", (u32 *)&dt_pdata->flow_cntrl);
++      of_property_read_u32(np, "baud_rate", (u32 *)&dt_pdata->baud_rate);
++
++      return dt_pdata;
++}
++
+ static struct dentry *kim_debugfs_dir;
+ static int kim_probe(struct platform_device *pdev)
+ {
+       struct kim_data_s       *kim_gdata;
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       int err;
++      if (pdev->dev.of_node)
++              pdata = get_platform_data(&pdev->dev);
++      else
++              pdata = pdev->dev.platform_data;
++
++      if (pdata == NULL) {
++              dev_err(&pdev->dev, "Platform Data is missing\n");
++              return -ENXIO;
++      }
++
+       if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
+               /* multiple devices could exist */
+               st_kim_devices[pdev->id] = pdev;
+@@ -808,9 +863,16 @@ err_core_init:
+ static int kim_remove(struct platform_device *pdev)
+ {
+       /* free the GPIOs requested */
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
+       struct kim_data_s       *kim_gdata;
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
++
+       kim_gdata = platform_get_drvdata(pdev);
+       /* Free the Bluetooth/FM/GPIO
+@@ -828,12 +890,22 @@ static int kim_remove(struct platform_device *pdev)
+       kfree(kim_gdata);
+       kim_gdata = NULL;
++      kfree(dt_pdata);
++      dt_pdata = NULL;
++
+       return 0;
+ }
+ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+ {
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
++
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
+       if (pdata->suspend)
+               return pdata->suspend(pdev, state);
+@@ -843,7 +915,14 @@ static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+ static int kim_resume(struct platform_device *pdev)
+ {
+-      struct ti_st_plat_data  *pdata = pdev->dev.platform_data;
++      struct ti_st_plat_data  *pdata;
++
++      if (pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = pdev->dev.platform_data;
++      }
+       if (pdata->resume)
+               return pdata->resume(pdev);
+@@ -861,6 +940,7 @@ static struct platform_driver kim_platform_driver = {
+       .driver = {
+               .name = "kim",
+               .owner = THIS_MODULE,
++              .of_match_table = of_match_ptr(kim_of_match),
+       },
+ };
+diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
+index 93b4d67..518e1b7 100644
+--- a/drivers/misc/ti-st/st_ll.c
++++ b/drivers/misc/ti-st/st_ll.c
+@@ -26,6 +26,7 @@
+ #include <linux/ti_wilink_st.h>
+ /**********************************************************************/
++
+ /* internal functions */
+ static void send_ll_cmd(struct st_data_s *st_data,
+       unsigned char cmd)
+@@ -53,7 +54,13 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
+       /* communicate to platform about chip asleep */
+       kim_data = st_data->kim_data;
+-      pdata = kim_data->kim_pdev->dev.platform_data;
++      if (kim_data->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_data->kim_pdev->dev.platform_data;
++      }
++
+       if (pdata->chip_asleep)
+               pdata->chip_asleep(NULL);
+ }
+@@ -86,7 +93,13 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
+       /* communicate to platform about chip wakeup */
+       kim_data = st_data->kim_data;
+-      pdata = kim_data->kim_pdev->dev.platform_data;
++      if (kim_data->kim_pdev->dev.of_node) {
++              pr_debug("use device tree data");
++              pdata = dt_pdata;
++      } else {
++              pdata = kim_data->kim_pdev->dev.platform_data;
++      }
++
+       if (pdata->chip_awake)
+               pdata->chip_awake(NULL);
+ }
+diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
+index 932b763..39e577c 100644
+--- a/include/linux/ti_wilink_st.h
++++ b/include/linux/ti_wilink_st.h
+@@ -86,6 +86,7 @@ struct st_proto_s {
+ extern long st_register(struct st_proto_s *);
+ extern long st_unregister(struct st_proto_s *);
++extern struct ti_st_plat_data   *dt_pdata;
+ /*
+  * header information used by st_core.c
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0009-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0009-mmc-Add-SDIO-function-devicetree-subnode-parsing.patch
new file mode 100644 (file)
index 0000000..d284688
--- /dev/null
@@ -0,0 +1,152 @@
+From 326443b0b47b0a718aac7a60f4c509d5636a9096 Mon Sep 17 00:00:00 2001
+From: Sascha Hauer <s.hauer@pengutronix.de>
+Date: Mon, 30 Jun 2014 11:07:25 +0200
+Subject: [PATCH 09/12] mmc: Add SDIO function devicetree subnode parsing
+
+This adds SDIO devicetree subnode parsing to the mmc core. While
+SDIO devices are runtime probable they sometimes need nonprobable
+additional information on embedded systems, like an additional gpio
+interrupt or a clock. This patch makes it possible to supply this
+information from the devicetree. SDIO drivers will find a pointer
+to the devicenode in their devices of_node pointer.
+
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+[hdegoede@redhat.com: Misc. cleanups]
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+---
+ drivers/mmc/core/bus.c      |    4 ++++
+ drivers/mmc/core/core.c     |   28 ++++++++++++++++++++++++++++
+ drivers/mmc/core/core.h     |    3 +++
+ drivers/mmc/core/sdio_bus.c |   11 +++++++++++
+ 4 files changed, 46 insertions(+)
+
+diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
+index d68debd..72df022 100644
+--- a/drivers/mmc/core/bus.c
++++ b/drivers/mmc/core/bus.c
+@@ -16,6 +16,7 @@
+ #include <linux/err.h>
+ #include <linux/slab.h>
+ #include <linux/stat.h>
++#include <linux/of.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/mmc/card.h>
+@@ -368,6 +369,8 @@ int mmc_add_card(struct mmc_card *card)
+ #endif
+       mmc_init_context_info(card->host);
++      card->dev.of_node = mmc_of_find_child_device(card->host, 0);
++
+       ret = device_add(&card->dev);
+       if (ret)
+               return ret;
+@@ -396,6 +399,7 @@ void mmc_remove_card(struct mmc_card *card)
+                               mmc_hostname(card->host), card->rca);
+               }
+               device_del(&card->dev);
++              of_node_put(card->dev.of_node);
+       }
+       put_device(&card->dev);
+diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
+index 79d5235..e12dbf9 100644
+--- a/drivers/mmc/core/core.c
++++ b/drivers/mmc/core/core.c
+@@ -1225,6 +1225,34 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
+ }
+ EXPORT_SYMBOL(mmc_of_parse_voltage);
++static int mmc_of_get_func_num(struct device_node *node)
++{
++      u32 reg;
++      int ret;
++
++      ret = of_property_read_u32(node, "reg", &reg);
++      if (ret < 0)
++              return ret;
++
++      return reg;
++}
++
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num)
++{
++      struct device_node *node;
++
++      if (!host->parent || !host->parent->of_node)
++              return NULL;
++
++      for_each_child_of_node(host->parent->of_node, node) {
++              if (mmc_of_get_func_num(node) == func_num)
++                      return node;
++      }
++
++      return NULL;
++}
++
+ #endif /* CONFIG_OF */
+ #ifdef CONFIG_REGULATOR
+diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
+index 443a584..f712f6e 100644
+--- a/drivers/mmc/core/core.h
++++ b/drivers/mmc/core/core.h
+@@ -32,6 +32,9 @@ struct mmc_bus_ops {
+ void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
+ void mmc_detach_bus(struct mmc_host *host);
++struct device_node *mmc_of_find_child_device(struct mmc_host *host,
++              unsigned func_num);
++
+ void mmc_init_erase(struct mmc_card *card);
+ void mmc_set_chip_select(struct mmc_host *host, int mode);
+diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
+index 872f45d..869c04c 100644
+--- a/drivers/mmc/core/sdio_bus.c
++++ b/drivers/mmc/core/sdio_bus.c
+@@ -21,7 +21,9 @@
+ #include <linux/mmc/card.h>
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sdio_func.h>
++#include <linux/of.h>
++#include "core.h"
+ #include "sdio_cis.h"
+ #include "sdio_bus.h"
+@@ -325,6 +327,13 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
+ static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
+ #endif
++static void sdio_set_of_node(struct sdio_func *func)
++{
++      struct mmc_host *host = func->card->host;
++
++      func->dev.of_node = mmc_of_find_child_device(host, func->num);
++}
++
+ /*
+  * Register a new SDIO function with the driver model.
+  */
+@@ -334,6 +343,7 @@ int sdio_add_func(struct sdio_func *func)
+       dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
++      sdio_set_of_node(func);
+       sdio_acpi_set_handle(func);
+       ret = device_add(&func->dev);
+       if (ret == 0) {
+@@ -357,6 +367,7 @@ void sdio_remove_func(struct sdio_func *func)
+       acpi_dev_pm_detach(&func->dev, false);
+       device_del(&func->dev);
++      of_node_put(func->dev.of_node);
+       put_device(&func->dev);
+ }
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0010-imx_v7_android_defconfig-enable-Wilink8-related-swit.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0010-imx_v7_android_defconfig-enable-Wilink8-related-swit.patch
new file mode 100644 (file)
index 0000000..542ad7d
--- /dev/null
@@ -0,0 +1,56 @@
+From 1bdb913bcbaf10efdb691b943e67309b8c6a3bd2 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Mon, 31 Aug 2015 09:33:38 +0300
+Subject: [PATCH 10/12] imx_v7_android_defconfig: enable Wilink8 related
+ switches
+
+* Disable internal mac80211 and cfg80211 as we are building wilink8
+  drivers using backport and loading as modules
+* enable wlan and hci related switches
+* enable bluetooth shared transport
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ arch/arm/configs/imx_v7_android_defconfig |   11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/configs/imx_v7_android_defconfig b/arch/arm/configs/imx_v7_android_defconfig
+index ff08f0f..6e4eb62 100644
+--- a/arch/arm/configs/imx_v7_android_defconfig
++++ b/arch/arm/configs/imx_v7_android_defconfig
+@@ -149,6 +149,7 @@ CONFIG_IP_NF_FILTER=y
+ CONFIG_IP_NF_TARGET_REJECT=y
+ CONFIG_NF_NAT_IPV4=y
+ CONFIG_IP_NF_TARGET_MASQUERADE=y
++CONFIG_IP_NF_TARGET_LOG=y
+ CONFIG_IP_NF_MANGLE=y
+ CONFIG_IP_NF_RAW=y
+ CONFIG_IP_NF_ARPTABLES=y
+@@ -185,13 +186,14 @@ CONFIG_BT_HCIUART=y
+ CONFIG_BT_HCIUART_H4=y
+ CONFIG_BT_HCIUART_BCSP=y
+ CONFIG_BT_HCIUART_ATH3K=y
++CONFIG_BT_WILINK=y
++CONFIG_BT_HCIUART_LL=y
+ CONFIG_BT_HCIBCM203X=y
+-CONFIG_CFG80211=m
+-CONFIG_CFG80211_WEXT=y
+-CONFIG_MAC80211=m
+ CONFIG_RFKILL=y
+ CONFIG_RFKILL_INPUT=y
+ CONFIG_RFKILL_GPIO=y
++CONFIG_OF=y
++CONFIG_PROC_DEVICETREE=y
+ CONFIG_DEVTMPFS=y
+ CONFIG_DEVTMPFS_MOUNT=y
+ # CONFIG_STANDALONE is not set
+@@ -641,3 +643,6 @@ CONFIG_CRC7=y
+ CONFIG_FONTS=y
+ CONFIG_FONT_8x8=y
+ CONFIG_FONT_8x16=y
++CONFIG_TI_ST=y
++CONFIG_ST_HCI=y
++# CONFIG_BCMDHD is not set
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0011-drivers-misc-ti-st-fix-debugfs-creation-error-handli.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0011-drivers-misc-ti-st-fix-debugfs-creation-error-handli.patch
new file mode 100644 (file)
index 0000000..b66773f
--- /dev/null
@@ -0,0 +1,44 @@
+From 04778ca38b2f756bd132106d65dd778e6af6a0a4 Mon Sep 17 00:00:00 2001
+From: Gigi Joseph <gigi.joseph@gmail.com>
+Date: Fri, 9 Jan 2015 03:47:51 +0000
+Subject: [PATCH 11/12] drivers: misc: ti-st: fix debugfs creation error
+ handling
+
+In case the debugfs creation fails the whole init process was failing.
+There is no need to do this as the shared transport can work without it.
+Fix it so it just reports the failure and continue.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+Signed-off-by: Gigi Joseph <gigi.joseph@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/ti-st/st_kim.c |    6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index e3471e7..fbce5a8 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -836,8 +836,7 @@ static int kim_probe(struct platform_device *pdev)
+       kim_debugfs_dir = debugfs_create_dir("ti-st", NULL);
+       if (IS_ERR(kim_debugfs_dir)) {
+               pr_err(" debugfs entries creation failed ");
+-              err = -EIO;
+-              goto err_debugfs_dir;
++              return 0;
+       }
+       debugfs_create_file("version", S_IRUGO, kim_debugfs_dir,
+@@ -846,9 +845,6 @@ static int kim_probe(struct platform_device *pdev)
+                               kim_gdata, &list_debugfs_fops);
+       pr_info(" debugfs entries created ");
+       return 0;
+-
+-err_debugfs_dir:
+-      sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
+ #endif
+ err_sysfs_group:
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0012-drivers-misc-ti-st-fix-null-pointer-exception-in-st_.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/0012-drivers-misc-ti-st-fix-null-pointer-exception-in-st_.patch
new file mode 100644 (file)
index 0000000..3b5c7eb
--- /dev/null
@@ -0,0 +1,66 @@
+From 7c4e301535cfd7d415e927d1effc8a2cc84f549d Mon Sep 17 00:00:00 2001
+From: Gigi Joseph <gigi.joseph@gmail.com>
+Date: Fri, 9 Jan 2015 03:48:29 +0000
+Subject: [PATCH 12/12] drivers: misc: ti-st: fix null pointer exception in
+ st_kim_ref()
+
+st_kim_ref() does not take care of the fact that platform_get_drvdata() might return NULL. On AM437x EVM, this causes the platform to stop booting as soon as the module is inserted.
+
+This patch fixes the issue by checking for NULL return value. Oops log follows.
+
+I have not tested BT functionality after this patch. But at least the platform boots now.
+
+[   12.675697] Unable to handle kernel NULL pointer dereference at virtual address 0000005c
+[   12.684310] pgd = c0004000
+[   12.687157] [0000005c] *pgd=00000000
+[   12.690927] Internal error: Oops: 17 [#1] SMP ARM
+[   12.695873] Modules linked in: btwilink bluetooth ti_vpfe dwc3(+) ov2659 videobuf2_core v4l2_common videodev ti_am335x_adc 6lowpan_iphc matrix_keypad panel_dpi kfifo_buf pixcir_i2c_ts media industrialio videobuf2_dma_contig c_can_platform videobuf2_memops dwc3_omap c_can can_dev
+[   12.721969] CPU: 0 PID: 1235 Comm: kworker/u3:0 Not tainted 3.14.25-02445-g9036ac6daed6 #128
+[   12.730937] Workqueue: hci0 hci_power_on [bluetooth]
+[   12.736165] task: ebd93b40 ti: ecd7c000 task.ti: ecd7c000
+[   12.741856] PC is at st_kim_ref+0x30/0x40
+[   12.746071] LR is at st_kim_ref+0x30/0x40
+[   12.750289] pc : [<c03caf58>]    lr : [<c03caf58>]    psr: a0000013
+[   12.750289] sp : ecd7de08  ip : ecd7de08  fp : ecd7de1c
+[   12.762365] r10: bf1e710c  r9 : bf1e70ec  r8 : bf1e7964
+[   12.767858] r7 : ebd2fd50  r6 : bf1e7964  r5 : 00000000  r4 : ecd7de24
+[   12.774723] r3 : c0957208  r2 : 00000000  r1 : c0957208  r0 : 00000000
+[   12.781589] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
+[   12.789274] Control: 10c5387d  Table: abde4059  DAC: 00000015
+[   12.795315] Process kworker/u3:0 (pid: 1235, stack limit = 0xecd7c248)
+
+Signed-off-by: Sekhar Nori <nsekhar@ti.com>
+Signed-off-by: Gigi Joseph <gigi.joseph@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/ti-st/st_kim.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
+index fbce5a8..a6d1447 100644
+--- a/drivers/misc/ti-st/st_kim.c
++++ b/drivers/misc/ti-st/st_kim.c
+@@ -690,12 +690,16 @@ void st_kim_ref(struct st_data_s **core_data, int id)
+       struct kim_data_s       *kim_gdata;
+       /* get kim_gdata reference from platform device */
+       pdev = st_get_plat_device(id);
+-      if (!pdev) {
+-              *core_data = NULL;
+-              return;
+-      }
++      if (!pdev)
++              goto err;
+       kim_gdata = platform_get_drvdata(pdev);
++      if (!kim_gdata)
++              goto err;
++
+       *core_data = kim_gdata->core_data;
++      return;
++err:
++      *core_data = NULL;
+ }
+ static int kim_version_open(struct inode *i, struct file *f)
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/device-fsl-patches/0001-sabresd_6dq-add-wilink8-wlan-platform-support.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/device-fsl-patches/0001-sabresd_6dq-add-wilink8-wlan-platform-support.patch
new file mode 100644 (file)
index 0000000..a5db75b
--- /dev/null
@@ -0,0 +1,185 @@
+From 46ee505111ca777090f33198a587fc066c1f9396 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Wed, 17 Feb 2016 15:47:03 +0200
+Subject: [PATCH] sabresd_6dq: add wilink8 wlan platform support
+
+Add wilink8 wlan support to the imx6 sabresd board.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ imx6/imx6.mk               |    1 -
+ imx6/sabresd_6dq.mk        |    5 +++++
+ sabresd_6dq/BoardConfig.mk |   32 ++++++++++++++++++++++++------
+ sabresd_6dq/init.rc        |   46 ++++++++++----------------------------------
+ 4 files changed, 41 insertions(+), 43 deletions(-)
+
+diff --git a/imx6/imx6.mk b/imx6/imx6.mk
+index e478de1..0d8df3c 100644
+--- a/imx6/imx6.mk
++++ b/imx6/imx6.mk
+@@ -41,7 +41,6 @@ PRODUCT_PACKAGES += \
+       ip-up-vpn                               \
+       ip-up-ppp0                              \
+       ip-down-ppp0                            \
+-      rtl_wpa_supplicant                      \
+       wpa_supplicant                          \
+       wpa_supplicant.conf                     \
+       p2p_supplicant_overlay.conf                     \
+diff --git a/imx6/sabresd_6dq.mk b/imx6/sabresd_6dq.mk
+index c6f9f7e..9c7046b 100644
+--- a/imx6/sabresd_6dq.mk
++++ b/imx6/sabresd_6dq.mk
+@@ -61,3 +61,8 @@ PRODUCT_COPY_FILES += \
+       frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml \
+       device/fsl/sabresd_6dq/required_hardware.xml:system/etc/permissions/required_hardware.xml
+ PRODUCT_PACKAGES += AudioRoute
++
++$(call inherit-product-if-exists, device/ti/proprietary-open/wl12xx/wlan/wl12xx-wlan-fw-products.mk)
++#$(call inherit-product-if-exists, device/ti/proprietary-open/wl12xx/wpan/wl12xx-wpan-fw-products.mk)
++#$(call inherit-product-if-exists, hardware/ti/wpan/ti-wpan-products.mk)
++
+diff --git a/sabresd_6dq/BoardConfig.mk b/sabresd_6dq/BoardConfig.mk
+index e2d036b..3e75615 100644
+--- a/sabresd_6dq/BoardConfig.mk
++++ b/sabresd_6dq/BoardConfig.mk
+@@ -46,12 +46,18 @@ PRODUCT_MODEL := SABRESD-MX6DQ
+ TARGET_RELEASETOOLS_EXTENSIONS := device/fsl/imx6
+ # UNITE is a virtual device support both atheros and realtek wifi(ar6103 and rtl8723as)
+-BOARD_WLAN_DEVICE            := UNITE
+-WPA_SUPPLICANT_VERSION       := VER_0_8_UNITE
++#BOARD_WLAN_DEVICE            := UNITE
++#WPA_SUPPLICANT_VERSION       := VER_0_8_UNITE
+ TARGET_KERNEL_MODULES        := \
+-                                kernel_imx/net/wireless/cfg80211.ko:system/lib/modules/cfg80211_realtek.ko \
+-                                kernel_imx/drivers/net/wireless/rtlwifi/rtl8821as/8821as.ko:system/lib/modules/8821as.ko \
+-                                kernel_imx/drivers/net/wireless/bcmdhd/bcmdhd.ko:system/lib/modules/bcmdhd.ko
++                              hardware/ti/wlan/mac80211/compat_wl18xx/compat/compat.ko:system/lib/modules/compat.ko \
++                              hardware/ti/wlan/mac80211/compat_wl18xx/net/mac80211/mac80211.ko:system/lib/modules/mac80211.ko \
++                              hardware/ti/wlan/mac80211/compat_wl18xx/net/wireless/cfg80211.ko:system/lib/modules/cfg80211.ko \
++                              hardware/ti/wlan/mac80211/compat_wl18xx/drivers/net/wireless/ti/wl18xx/wl18xx.ko:system/lib/modules/wl18xx.ko \
++                              hardware/ti/wlan/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/wlcore.ko:system/lib/modules/wlcore.ko \
++                              hardware/ti/wlan/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko:system/lib/modules/wlcore_sdio.ko
++#                                kernel_imx/net/wireless/cfg80211.ko:system/lib/modules/cfg80211_realtek.ko \
++#                                kernel_imx/drivers/net/wireless/rtlwifi/rtl8821as/8821as.ko:system/lib/modules/8821as.ko \
++#                                kernel_imx/drivers/net/wireless/bcmdhd/bcmdhd.ko:system/lib/modules/bcmdhd.ko
+ BOARD_WPA_SUPPLICANT_DRIVER  := NL80211
+ BOARD_HOSTAPD_DRIVER         := NL80211
+@@ -61,7 +67,7 @@ BOARD_WPA_SUPPLICANT_PRIVATE_LIB_RTL        := lib_driver_cmd_rtl
+ BOARD_HOSTAPD_PRIVATE_LIB_BCM               := lib_driver_cmd_bcmdhd
+ BOARD_WPA_SUPPLICANT_PRIVATE_LIB_BCM        := lib_driver_cmd_bcmdhd
+-BOARD_SUPPORT_BCM_WIFI  := true
++#BOARD_SUPPORT_BCM_WIFI  := true
+ #for intel vendor
+ ifeq ($(BOARD_WLAN_VENDOR),INTEL)
+ BOARD_HOSTAPD_PRIVATE_LIB                := private_lib_driver_cmd
+@@ -74,6 +80,20 @@ WIFI_DRIVER_MODULE_NAME                  := "iwlagn"
+ WIFI_DRIVER_MODULE_PATH                  ?= auto
+ endif
++# Connectivity - Wi-Fi
++USES_TI_MAC80211 := true
++ifeq ($(USES_TI_MAC80211),true)
++BOARD_WPA_SUPPLICANT_DRIVER := NL80211
++WPA_SUPPLICANT_VERSION      := VER_0_8_X
++BOARD_HOSTAPD_DRIVER        := NL80211
++BOARD_WPA_SUPPLICANT_PRIVATE_LIB  := lib_driver_cmd_wl12xx
++BOARD_HOSTAPD_PRIVATE_LIB         := lib_driver_cmd_wl12xx
++BOARD_WLAN_DEVICE           := wl12xx_mac80211
++BOARD_SOFTAP_DEVICE         := wl12xx_mac80211
++COMMON_GLOBAL_CFLAGS += -DUSES_TI_MAC80211
++COMMON_GLOBAL_CFLAGS += -DANDROID_P2P_STUB
++endif
++
+ WIFI_DRIVER_FW_PATH_STA        := "/system/etc/firmware/bcm/fw_bcmdhd.bin"
+ WIFI_DRIVER_FW_PATH_P2P        := "/system/etc/firmware/bcm/fw_bcmdhd.bin"
+ WIFI_DRIVER_FW_PATH_AP         := "/system/etc/firmware/bcm/fw_bcmdhd_apsta.bin"
+diff --git a/sabresd_6dq/init.rc b/sabresd_6dq/init.rc
+index e65826f..84f4edd 100755
+--- a/sabresd_6dq/init.rc
++++ b/sabresd_6dq/init.rc
+@@ -35,6 +35,14 @@ on init
+     write /sys/class/vtconsole/vtcon1/bind 0
+ on boot
++    # wl18xx wi-fi
++    insmod /system/lib/modules/compat.ko
++    insmod /system/lib/modules/cfg80211.ko
++    insmod /system/lib/modules/mac80211.ko
++    insmod /system/lib/modules/wlcore.ko
++    insmod /system/lib/modules/wl12xx.ko
++    insmod /system/lib/modules/wl18xx.ko
++    insmod /system/lib/modules/wlcore_sdio.ko
+     # emmulate battery property
+     setprop sys.emulated.battery 1
+@@ -93,7 +101,7 @@ on boot
+ #  Enable adb security for JB4.2.2
+-    setprop ro.adb.secure 1
++    setprop ro.adb.secure 0
+     # Set rotation to 270 to cofigure as portrait mode
+     setprop ro.sf.hwrotation 0
+@@ -195,40 +203,13 @@ on property:sys.interactive="active"
+     chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+     chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+-
+ service p2p_supplicant /system/bin/wpa_supplicant \
+-    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
+-    -I/system/etc/wifi/p2p_supplicant_advance_overlay.conf -N \
+     -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
+     -I/system/etc/wifi/wpa_supplicant_overlay.conf \
+-    -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
++    -O/data/misc/wifi/sockets -pp2p_device=1\
+     -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
+-    class late_start
+     socket wpa_wlan0 dgram 660 wifi wifi
+-    disabled
+-    oneshot
+-
+-service rtw_suppl_con /system/bin/rtl_wpa_supplicant \
+-    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
+-    -I/system/etc/wifi/p2p_supplicant_overlay.conf -N \
+-    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
+-    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
+-    -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
+-    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
+     class late_start
+-    socket wpa_wlan0 dgram 660 wifi wifi
+-    disabled
+-    oneshot
+-
+-service rtw_supplc_adv /system/bin/rtl_wpa_supplicant \
+-    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
+-    -I/system/etc/wifi/p2p_supplicant_advance_overlay.conf -N \
+-    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
+-    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
+-    -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
+-    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
+-    class late_start
+-    socket wpa_wlan0 dgram 660 wifi wifi
+     disabled
+     oneshot
+@@ -302,13 +283,6 @@ service hostapd /system/bin/hostapd /data/misc/wifi/hostapd.conf
+     oneshot
+     disabled
+-service rtl_hostapd /system/bin/hostapd /data/misc/wifi/hostapd.conf
+-    socket hostapd_wlan0 dgram 660 root wifi
+-    user root
+-    group wifi
+-    oneshot
+-    disabled
+-
+ service ril-daemon /system/bin/rild
+     class main
+     socket rild stream 660 root radio
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/external-sepolicy-patches/0001-sepolicy-enable-loading-of-modules.patch b/patches/kernel_patches/imx-3.14.52-android-5.1.1_2.1.0-ga/external-sepolicy-patches/0001-sepolicy-enable-loading-of-modules.patch
new file mode 100644 (file)
index 0000000..c7aead0
--- /dev/null
@@ -0,0 +1,27 @@
+From abbe2fdb8654ab914125cdf4024efbbd6663d0bf Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Thu, 18 Feb 2016 11:09:26 +0200
+Subject: [PATCH] sepolicy: enable loading of modules
+
+Allow kernel modules to be loaded "insmod" on boot
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ init.te |    1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/init.te b/init.te
+index b5b7993..a63b063 100644
+--- a/init.te
++++ b/init.te
+@@ -5,6 +5,7 @@ unconfined_domain(init)
+ tmpfs_domain(init)
+ allow init self:capability { sys_rawio mknod };
++allow init self:capability { sys_module };
+ # Run helpers from / or /system without changing domain.
+ # We do not include exec_type here since generally those
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/linux-4.1-at91/0001-mmc-sdhci-restore-behavior-when-setting-VDD-via-exte.patch b/patches/kernel_patches/linux-4.1-at91/0001-mmc-sdhci-restore-behavior-when-setting-VDD-via-exte.patch
new file mode 100644 (file)
index 0000000..696c62e
--- /dev/null
@@ -0,0 +1,79 @@
+From 6a61a1244e1469657cce8c6156c4ec2841e9fa38 Mon Sep 17 00:00:00 2001
+From: Jisheng Zhang <jszhang@marvell.com>
+Date: Fri, 11 Dec 2015 21:36:29 +0800
+Subject: [PATCH 1/2] mmc: sdhci: restore behavior when setting VDD via
+ external regulator
+
+After commit 52221610dd84 ("mmc: sdhci: Improve external VDD regulator
+support"), for the VDD is supplied via external regulators, we ignore
+the code to convert a VDD voltage request into one of the standard
+SDHCI voltage levels, then program it in the SDHCI_POWER_CONTROL. This
+brings two issues:
+
+1. SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON quirk isn't handled properly any
+more.
+
+2. What's more, once SDHCI_POWER_ON bit is set, some controllers such
+as the sdhci-pxav3 used in marvell berlin SoCs require the voltage
+levels programming in the SDHCI_POWER_CONTROL register, even the VDD
+is supplied by external regulator. So the host in marvell berlin SoCs
+still works fine after the commit. However, commit 3cbc6123a93d ("mmc:
+sdhci: Set SDHCI_POWER_ON with external vmmc") sets the SDHCI_POWER_ON
+bit, this would make the host in marvell berlin SoCs won't work any
+more with external vmmc.
+
+This patch restores the behavior when setting VDD through external
+regulator by moving the call of mmc_regulator_set_ocr() to the end
+of sdhci_set_power() function.
+
+After this patch, the sdcard on Marvell Berlin SoC boards work again.
+
+Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
+Fixes: 52221610dd84 ("mmc: sdhci: Improve external VDD ...")
+Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com>
+Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+---
+ drivers/mmc/host/sdhci.c |   19 ++++++-------------
+ 1 file changed, 6 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
+index da89f4e..74672b7 100644
+--- a/drivers/mmc/host/sdhci.c
++++ b/drivers/mmc/host/sdhci.c
+@@ -1295,19 +1295,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
+       struct mmc_host *mmc = host->mmc;
+       u8 pwr = 0;
+-      if (!IS_ERR(mmc->supply.vmmc)) {
+-              spin_unlock_irq(&host->lock);
+-              mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+-              spin_lock_irq(&host->lock);
+-
+-              if (mode != MMC_POWER_OFF)
+-                      sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
+-              else
+-                      sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
+-
+-              return;
+-      }
+-
+       if (mode != MMC_POWER_OFF) {
+               switch (1 << vdd) {
+               case MMC_VDD_165_195:
+@@ -1366,6 +1353,12 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
+               if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER)
+                       mdelay(10);
+       }
++
++      if (!IS_ERR(mmc->supply.vmmc)) {
++              spin_unlock_irq(&host->lock);
++              mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
++              spin_lock_irq(&host->lock);
++      }
+ }
+ /*****************************************************************************\
+-- 
+1.7.9.5
+
diff --git a/patches/kernel_patches/linux-4.1-at91/0002-sama5d2_xplained-add-wilink8-wifi-support.patch b/patches/kernel_patches/linux-4.1-at91/0002-sama5d2_xplained-add-wilink8-wifi-support.patch
new file mode 100644 (file)
index 0000000..cd0b558
--- /dev/null
@@ -0,0 +1,79 @@
+From 9535933a48b084df96b3d565227b0999367fd751 Mon Sep 17 00:00:00 2001
+From: Eyal Reizer <eyalr@ti.com>
+Date: Tue, 3 May 2016 14:07:55 +0300
+Subject: [PATCH 2/2] sama5d2_xplained: add wilink8 wifi support
+
+The wilink8 module can be connected to the sama5d2-xplained platform
+using the sdmmc1 port and two out-of-band gpio control lines.
+Add wilink8 wlan device tree support with the following additions:
+
+- PA23 is muxed as gpio and used for wlan_enable
+- PA24 is muxed as gpio as gpio and used for wlan_irq
+- Add fixed regulator controling wlan_enable and attach it to sdmmc1
+  that the wilink8 module is connected to.
+- Add the wlore subnode information into the sdmmc1 node.
+
+Signed-off-by: Eyal Reizer <eyalr@ti.com>
+---
+ .../arm/boot/dts/at91-sama5d2_xplained_common.dtsi |   30 +++++++++++++++++++-
+ 1 file changed, 29 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained_common.dtsi b/arch/arm/boot/dts/at91-sama5d2_xplained_common.dtsi
+index fde52a6..f32e4d8 100644
+--- a/arch/arm/boot/dts/at91-sama5d2_xplained_common.dtsi
++++ b/arch/arm/boot/dts/at91-sama5d2_xplained_common.dtsi
+@@ -79,6 +79,15 @@
+               };
+       };
++      wlan_en_reg: fixedregulator {
++              compatible = "regulator-fixed";
++              regulator-name = "wlan-en-regulator";
++              regulator-min-microvolt = <3300000>;
++              regulator-max-microvolt = <3300000>;
++              gpio = <&pioA 23 GPIO_ACTIVE_HIGH>;
++              enable-active-high;
++      };
++
+       ahb {
+               usb0: gadget@00300000 {
+                       atmel,vbus-gpio = <&pioA 31 GPIO_ACTIVE_HIGH>;
+@@ -114,8 +123,21 @@
+               sdmmc1: sdio-host@b0000000 {
+                       bus-width = <4>;
+                       pinctrl-names = "default";
+-                      pinctrl-0 = <&pinctrl_sdmmc1_default>;
++                      pinctrl-0 = <&pinctrl_sdmmc1_default &pinctrl_wlan_default>;
++                      keep-power-in-suspend;
++                      enable-sdio-wakeup;
++                      vmmc-supply = <&wlan_en_reg>;
+                       status = "okay"; /* conflict with qspi0 */
++                      non-removable;
++                      cap-power-off-card;
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++                      wlcore: wlcore@0 {
++                              compatible = "ti,wl1835";
++                              reg = <2>;
++                              interrupt-parent = <&pioA>;
++                              interrupts = <24 IRQ_TYPE_EDGE_RISING>;
++                      };
+               };
+               apb {
+@@ -654,6 +676,12 @@
+                                       };
+                               };
++                              pinctrl_wlan_default: wlan_default {
++                                              pinmux = <PIN_PA23__GPIO>, /* WLAN_EN */
++                                                       <PIN_PA24__GPIO>; /* WLAN_IRQ */
++                                              bias-pull-up;
++                              };
++
+                               pinctrl_sensor_power: sensor_power {
+                                       pinmux = <PIN_PB12__GPIO>;
+                                       bias-disable;
+-- 
+1.7.9.5
+
index b9b72e88c8e3335a1edc7f3a991eb3004c356558..313a9241c2852e33bc681290e4780a4f0759d541 100755 (executable)
@@ -1,4 +1,3 @@
-#!/bin/sh
 
 function usage ()
 {