ARM: dts: ux500: samsung-golden: Add WiFi
authorStephan Gerhold <stephan@gerhold.net>
Thu, 19 Dec 2019 20:20:50 +0000 (21:20 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 25 Dec 2019 23:11:59 +0000 (00:11 +0100)
samsung-golden uses a BCM4334 WiFi+BT combo chip, connected to SDIO.
It is supported by the brcmfmac driver in mainline,
so we only need to set up the device tree to make it work correctly.

Note: brcmfmac requires (proprietary) firmware + a device-specific
NVRAM file. Both can be extracted from the stock Android system
used on samsung-golden:
  - /system/etc/wifi/bcmdhd_sta.bin_b2   -> /lib/firmware/brcm/brcmfmac4334-sdio.bin
  - /system/etc/wifi/nvram_net.txt_GPIO4 -> /lib/firmware/brcm/brcmfmac4334-sdio.samsung,golden.txt

brcmfmac4334-sdio.bin from linux-firmware also seems to work,
but results in occasional errors for some reason.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20191219202052.19039-8-stephan@gerhold.net
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/boot/dts/ste-ux500-samsung-golden.dts

index e75a425..d22b287 100644 (file)
                        non-removable;
                        cap-sd-highspeed;
 
+                       vmmc-supply = <&wl_reg_on>;
+
                        pinctrl-names = "default", "sleep";
                        pinctrl-0 = <&mc1_a_2_default>;
                        pinctrl-1 = <&mc1_a_2_sleep>;
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       wifi@1 {
+                               compatible = "brcm,bcm4329-fmac";
+                               reg = <1>;
+
+                               /* GPIO216 (WLAN_HOST_WAKE) */
+                               interrupt-parent = <&gpio6>;
+                               interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
+                               interrupt-names = "host-wake";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&wlan_default>;
+                       };
                };
 
                /* eMMC */
                pinctrl-names = "default";
                pinctrl-0 = <&sd_level_translator_default>;
        };
+
+       /*
+        * WL_REG_ON takes WLAN out of reset and enables the internal regulators.
+        * The voltage specified here is only used to determine the OCR mask,
+        * the BCM chip is actually connected directly to VBAT.
+        */
+       wl_reg_on: regulator-wl-reg-on {
+               compatible = "regulator-fixed";
+
+               regulator-name = "wl-reg-on";
+               regulator-min-microvolt = <3000000>;
+               regulator-max-microvolt = <3000000>;
+
+               startup-delay-us = <100000>;
+
+               /* GPIO215 (WLAN_EN) */
+               gpio = <&gpio6 23 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&wlan_en_default>;
+       };
 };
 
 &pinctrl {
                };
        };
 
+       wlan {
+               wlan_default: wlan_default {
+                       golden_cfg1 {
+                               pins = "GPIO216_AG12";  /* WLAN_HOST_WAKE */
+                               ste,config = <&gpio_in_pd>;
+                       };
+               };
+
+               wlan_en_default: wlan_en_default {
+                       golden_cfg1 {
+                               pins = "GPIO215_AH13";  /* WLAN_EN */
+                               ste,config = <&gpio_out_lo>;
+                       };
+               };
+       };
+
        vibrator {
                vibrator_default: vibrator_default {
                        golden_cfg1 {