samad52-xplained: add wilink8 wlan support for k4.1
authorEyal Reizer <eyalr@ti.com>
Thu, 5 May 2016 06:49:08 +0000 (09:49 +0300)
committerEyal Reizer <eyalr@ti.com>
Thu, 5 May 2016 06:49:08 +0000 (09:49 +0300)
- Add wlan support for the atmel samad52-xplained platform
- Based on linux4sam kernel, linux-4.1-at91 branch

Signed-off-by: Eyal Reizer <eyalr@ti.com>
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]

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
+