From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69B0EC433DB for ; Sun, 14 Mar 2021 01:55:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF97464EC4 for ; Sun, 14 Mar 2021 01:55:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF97464EC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=rxBdi0ICA1KuTk+MFggpJduBgqQoJGhHzHwn2fKmQtY=; b=hjBsZ2Inlvi+HqZlr+A731xmK1 YJ1gGiY0dvV3xKTK6gzRXPG5Ts85moA7dcI50rfSOwk1cLFlvbamhtWHmjjZMvMcjCfWiByKbSBKA 4gabr+CQ2TyKZ3EjjspmBxfNiHRsLhoiGG572UZ6uihDKTM/6Xs0vWqh10c/BUyGNIZC5Vs2buiDx z2pbjZtuVxPrq8aZ6Z4lwJ/GPaHTZgRduHMCHI/Rrlkk6moit5V/us//59Zl8+j8+HC57wyyGGot4 lLh+vuqyVmtxrozoF94N6FTVspk6acpmfBbyPLa1pP468qcQghcdMzutGbtbkf1Au+4f2sRL/au8e 0aDtf9zw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lLFwb-00DnsK-1Z; Sun, 14 Mar 2021 01:53:25 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lLFwU-00Dnr5-LR for linux-arm-kernel@lists.infradead.org; Sun, 14 Mar 2021 01:53:21 +0000 Received: by mail-lj1-x231.google.com with SMTP id u20so12075952lja.13 for ; Sat, 13 Mar 2021 17:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+zakiPyjabUD3HQP9xdF0h/N7RahG/s7nrI2OAjmeXA=; b=ghOeo73N93Tq4a30BbNg13EL2V9joHc2p3b01UOrPr95wAM6QHRsKJIpnw7gU61HNa lyAe/serHJUWuYfNmBShIbn08AXgdaifPuFTvDvh9ikrzx/1imEBxlqod/tM1TOrrN8l vdPuouW9K4t3sxjbHpEkKPqvShuIkFlpSp5gE7cRUuvOvLDSXs4zUtWa0N6jlTufe+lC xJHvL4NKZ2Hh9gepybhh2w2oiMnKqW2Bvm3T9vJu4S842LqtO4gi8jBhr0iSbwpEdRzA tvUK6fx7lZg/iamWiqrkdzWuWQ3s7F2lpsNOJuVMox16wxxkMApc82eQetsvCyBNswik BPpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+zakiPyjabUD3HQP9xdF0h/N7RahG/s7nrI2OAjmeXA=; b=LSfYWX/UODrp0O1ZhQf5Muq2hHmG95U+3CIG5/Ade/DTU8lKEA1kqQbg2Qpf1R3XCx /n6DzX/UfyozKKYAqCMQUKmI2hLg/ZLCdJkB/llABQftbn6s1HrnMh60YVzvA0xi4cEq C04nZgMc8rsLLt7J/VRN9c4MqzzFzLgi0aLYnmN32nvM5DWla4aW12dWZDDZdn0aODDs peC6cpkggm09fRsSAcI7bF0YZimkPMFbhnvyHKsGqoIFa7YtWGwds9ZXww2mirDbNJRf xsp32b1O4niZFNRzLvfUaheW7fxOqdu+HAyMV/zJJ4tUEgKCT89PHrGB6gkiGFeqHLEb w9iA== X-Gm-Message-State: AOAM533X+z4eFAHLIFVdHk+G6AaDAVefwlpmOKRv2AnAjmiNLX5zhlGX 2osRwFHnJyh5LBvoTUm0cU6BABu2SdcBOgPXD9M= X-Google-Smtp-Source: ABdhPJyelu748640LC9lLDBpqRamc1ogVPZTGCBcG58AaPIlWWeFxUU1Qz6e3EXr7ZKWO1LWoTEJHA== X-Received: by 2002:a2e:994f:: with SMTP id r15mr6453686ljj.386.1615686796786; Sat, 13 Mar 2021 17:53:16 -0800 (PST) Received: from localhost.localdomain (c-d7cb225c.014-348-6c756e10.bbcust.telenor.se. [92.34.203.215]) by smtp.gmail.com with ESMTPSA id u16sm2171277lff.169.2021.03.13.17.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 17:53:16 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Cc: Linus Walleij , Stephan Gerhold Subject: [PATCH] ARM: dts: ux500: Fix BT+WLAN on Samsung phones Date: Sun, 14 Mar 2021 02:53:11 +0100 Message-Id: <20210314015311.39229-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210314_015318_886299_B130579F X-CRM114-Status: GOOD ( 27.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some of the Samsung phones had set GPIO 215 as voltage regulator GPIO, while in fact this is always on GPIO 222. Using GPIO 215 meant that the Bluetooth would not come on properly since both WLAN and Bluetooth use GPIO 222 to power up. The Bluetooth part refers to this GPIO line as "shutdown-gpios" which is kind of true, but fails to mention that it will also shut down the WLAN when it is disabled, which was causing bugs. So we change the regulator for WLAN and Bluetooth to GPIO 222 and edit some names and comments to make it clear that this is the common regulator for both functions. Both WLAN and Bluetooth now use this regulator for powering up, and the regulator framework will reference count it and make sure that one part does not power down the other. However GPIO 215 still needs to be driven high (active low) since otherwise the WLAN part of the chip is being held in RESET, and that will make the SDIO WLAN not enumerate. To solve this, make the pin config entry for the power regulator also drive GPIO 215 high, but leave it to the driver to later on acquire and control this GPIO line. This is a bit of a hack and marked as such, but it works just fine: both SDIO WLAN and Bluetooth come up just fine on all the phones, with the right firmware provided. Cc: Stephan Gerhold Signed-off-by: Linus Walleij --- .../arm/boot/dts/ste-ux500-samsung-golden.dts | 99 ++++++++++++------- .../arm/boot/dts/ste-ux500-samsung-janice.dts | 33 ++++--- .../arm/boot/dts/ste-ux500-samsung-skomer.dts | 73 +++++++++++--- 3 files changed, 141 insertions(+), 64 deletions(-) diff --git a/arch/arm/boot/dts/ste-ux500-samsung-golden.dts b/arch/arm/boot/dts/ste-ux500-samsung-golden.dts index 0d43ee6583cf..c4c14aedf068 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-golden.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-golden.dts @@ -71,6 +71,28 @@ magnetometer@c { }; }; + /* + * This regulator is a GPIO line that drives the Broadcom WLAN + * and Bluetooth line BT_VREG_EN high and enables the internal + * regulators inside the chip. + * + * The voltage specified here is only used to determine the OCR mask, + * the for the SDIO connector, the chip is actually connected + * directly to VBAT. + */ + wl_bt_reg: regulator-gpio-wlan-bt { + compatible = "regulator-fixed"; + regulator-name = "BT_VREG_EN"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + startup-delay-us = <100000>; + /* GPIO222 (BT_VREG_EN) */ + gpio = <&gpio6 30 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-names = "default"; + pinctrl-0 = <&wlan_bt_ldo_en_default>; + }; + soc { /* External Micro SD card slot */ mmc@80126000 { @@ -111,8 +133,6 @@ mmc@80118000 { 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>; @@ -120,10 +140,22 @@ mmc@80118000 { #address-cells = <1>; #size-cells = <0>; + /* + * GPIO-controlled voltage enablement: this drives + * the BT_VREG_EN line high when we use this device. + * Represented as regulator to fill OCR mask and to + * be usable in parallel with the Bluetooth chip. + */ + vmmc-supply = <&wl_bt_reg>; + wifi@1 { + /* BRCM4334 actually */ compatible = "brcm,bcm4329-fmac"; reg = <1>; + /* GPIO215 WLAN_RST_N */ + reset-gpios = <&gpio6 23 GPIO_ACTIVE_LOW>; + /* GPIO216 (WLAN_HOST_WAKE) */ interrupt-parent = <&gpio6>; interrupts = <24 IRQ_TYPE_EDGE_FALLING>; @@ -162,9 +194,17 @@ uart@80120000 { pinctrl-1 = <&u0_a_1_sleep>; bluetooth { + /* BRCM4334B0 actually */ compatible = "brcm,bcm4330-bt"; - /* GPIO222 (BT_VREG_ON) */ - shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>; + /* + * We actually have shutdown-gpios, BT_VREG_ON on GPIO222, + * but since this GPIO is shared with the WLAN chip, we need + * to reference the regulator instead. The regulator + * framework will reference count the GPIO usage and + * make sure we can use the same GPIO for several supplies. + */ + // shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>; + vbat-supply = <&wl_bt_reg>; /* GPIO199 (BT_WAKE) */ device-wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>; /* GPIO97 (BT_HOST_WAKE) */ @@ -447,28 +487,6 @@ sd_level_translator: regulator-sd-level-translator { 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>; - }; - /* MIC5366 GPIO-controlled regulator */ panel_reg_1v8: regulator-panel-1v8 { compatible = "regulator-fixed"; @@ -641,25 +659,38 @@ golden_cfg1 { ste,config = <&gpio_in_pd>; }; }; + }; - wlan_en_default: wlan_en_default { + bluetooth { + bluetooth_default: bluetooth_default { golden_cfg1 { - pins = "GPIO215_AH13"; /* WLAN_EN */ + pins = "GPIO199_AH23"; /* BT_WAKE */ ste,config = <&gpio_out_lo>; }; + golden_cfg2 { + pins = "GPIO97_D9"; /* BT_HOST_WAKE */ + ste,config = <&gpio_in_nopull>; + }; }; }; - bluetooth { - bluetooth_default: bluetooth_default { + /* GPIO that enables the WLAN and Bluetooth internal LDO regulators */ + wlan-bt-ldo { + wlan_bt_ldo_en_default: wlan_bt_ldo_default { + /* GPIO222 BT_VREG_ON */ golden_cfg1 { - pins = "GPIO199_AH23", /* BT_WAKE */ - "GPIO222_AJ9"; /* BT_VREG_ON */ + pins = "GPIO222_AJ9"; ste,config = <&gpio_out_lo>; }; + /* + * HACK: this is the WL_RESET line that technically has nothing + * to do with the regulator, but in order for the SDIO card + * to enumerate, this must be driven high, so we need to do + * that here. + */ golden_cfg2 { - pins = "GPIO97_D9"; /* BT_HOST_WAKE */ - ste,config = <&gpio_in_nopull>; + pins = "GPIO215_AH13"; /* WLAN_EN */ + ste,config = <&gpio_out_hi>; }; }; }; diff --git a/arch/arm/boot/dts/ste-ux500-samsung-janice.dts b/arch/arm/boot/dts/ste-ux500-samsung-janice.dts index 7411bfeda285..ac1176788e8d 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-janice.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-janice.dts @@ -135,14 +135,14 @@ lcd_1v8_reg: regulator-gpio-lcd-1v8 { /* * This regulator is a GPIO line that drives the Broadcom WLAN - * line BT_VREG_EN high and enables the internal regulators - * inside the chip. + * and Bluetooth line BT_VREG_EN high and enables the internal + * regulators inside the chip. * * The voltage specified here is only used to determine the OCR mask, * the for the SDIO connector, the chip is actually connected * directly to VBAT. */ - wl_bt_reg: regulator-gpio-wlan { + wl_bt_reg: regulator-gpio-wlan-bt { compatible = "regulator-fixed"; regulator-name = "BT_VREG_EN"; regulator-min-microvolt = <3000000>; @@ -152,7 +152,7 @@ wl_bt_reg: regulator-gpio-wlan { gpio = <&gpio6 30 GPIO_ACTIVE_HIGH>; enable-active-high; pinctrl-names = "default"; - pinctrl-0 = <&wlan_ldo_en_default>; + pinctrl-0 = <&wlan_bt_ldo_en_default>; }; @@ -401,7 +401,7 @@ mmc@80118000 { status = "okay"; wifi@1 { - /* Actually BRCM4330 */ + /* BRCM4330 actually */ compatible = "brcm,bcm4329-fmac"; reg = <1>; /* GPIO216 WL_HOST_WAKE */ @@ -409,7 +409,6 @@ wifi@1 { interrupts = <24 IRQ_TYPE_EDGE_FALLING>; interrupt-names = "host-wake"; /* GPIO215 WLAN_RST_N */ - /* FIXME: kernel does not use this assert/deassert */ reset-gpios = <&gpio6 23 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&wlan_default_mode>; @@ -439,6 +438,7 @@ uart@80120000 { status = "okay"; bluetooth { + /* BRCM4330B1 actually */ compatible = "brcm,bcm4330-bt"; /* * We actually have shutdown-gpios, BT_VREG_EN on GPIO222, @@ -756,14 +756,24 @@ janice_cfg1 { }; }; }; - /* GPIO that enables the WLAN internal LDO regulators */ - wlan-ldo { - wlan_ldo_en_default: wlan_ldo_default { + /* GPIO that enables the WLAN and Bluetooth internal LDO regulators */ + wlan-bt-ldo { + wlan_bt_ldo_en_default: wlan_bt_ldo_default { /* GPIO222 BT_VREG_ON */ janice_cfg1 { pins = "GPIO222_AJ9"; ste,config = <&gpio_out_lo>; }; + /* + * HACK: this is the WL_RESET line that technically has nothing + * to do with the regulator, but in order for the SDIO card + * to enumerate, this must be driven high, so we need to do + * that here. + */ + janice_cfg2 { + pins = "GPIO215_AH13"; /* RESET_N */ + ste,config = <&gpio_out_hi>; + }; }; }; /* Flash and torch */ @@ -875,11 +885,6 @@ janice_cfg2 { }; wlan { wlan_default_mode: wlan_default { - /* GPIO215 used for RESET_N */ - janice_cfg1 { - pins = "GPIO215_AH13"; - ste,config = <&gpio_out_lo>; - }; /* GPIO216 for WL_HOST_WAKE */ janice_cfg2 { pins = "GPIO216_AG12"; diff --git a/arch/arm/boot/dts/ste-ux500-samsung-skomer.dts b/arch/arm/boot/dts/ste-ux500-samsung-skomer.dts index d28a00757d0b..319b1947573c 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-skomer.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-skomer.dts @@ -52,17 +52,26 @@ ldo_3v3_reg: regulator-gpio-ldo-3v3 { pinctrl-0 = <&emmc_ldo_en_default_mode>; }; - wlan_en: regulator-gpio-wlan-en { + /* + * This regulator is a GPIO line that drives the Broadcom WLAN + * and Bluetooth line BT_VREG_EN high and enables the internal + * regulators inside the chip. + * + * The voltage specified here is only used to determine the OCR mask, + * the for the SDIO connector, the chip is actually connected + * directly to VBAT. + */ + wl_bt_reg: regulator-gpio-wlan-bt { compatible = "regulator-fixed"; - regulator-name = "wl-reg-on"; + regulator-name = "BT_VREG_EN"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3000000>; - startup-delay-us = <200000>; - /* GPIO215 WLAN_EN */ - gpio = <&gpio6 23 GPIO_ACTIVE_HIGH>; + startup-delay-us = <100000>; + /* GPIO222 (BT_VREG_EN) */ + gpio = <&gpio6 30 GPIO_ACTIVE_HIGH>; enable-active-high; pinctrl-names = "default"; - pinctrl-0 = <&wlan_en_default_mode>; + pinctrl-0 = <&wlan_bt_ldo_en_default>; }; vibrator { @@ -202,7 +211,6 @@ mmc@80118000 { bus-width = <4>; non-removable; cap-sd-highspeed; - vmmc-supply = <&wlan_en>; pinctrl-names = "default", "sleep"; pinctrl-0 = <&mc1_a_2_default>; pinctrl-1 = <&mc1_a_2_sleep>; @@ -210,9 +218,20 @@ mmc@80118000 { #address-cells = <1>; #size-cells = <0>; + /* + * GPIO-controlled voltage enablement: this drives + * the BT_VREG_EN line high when we use this device. + * Represented as regulator to fill OCR mask and to + * be usable in parallel with the Bluetooth chip. + */ + vmmc-supply = <&wl_bt_reg>; + wifi@1 { + /* BRCM4334 actually */ compatible = "brcm,bcm4329-fmac"; reg = <1>; + /* GPIO215 WLAN_RST_N */ + reset-gpios = <&gpio6 23 GPIO_ACTIVE_LOW>; /* GPIO216 WL_HOST_WAKE */ interrupt-parent = <&gpio6>; interrupts = <24 IRQ_TYPE_EDGE_FALLING>; @@ -245,10 +264,18 @@ uart@80120000 { pinctrl-1 = <&u0_a_1_sleep>; status = "okay"; - /* FIXME: not quite working yet, probably needs regulators */ bluetooth { + /* BRCM4334B0 actually */ compatible = "brcm,bcm4330-bt"; - shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>; + /* + * We actually have shutdown-gpios, BT_VREG_ON on GPIO222, + * but since this GPIO is shared with the WLAN chip, we need + * to reference the regulator instead. The regulator + * framework will reference count the GPIO usage and + * make sure we can use the same GPIO for several supplies. + */ + // shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>; + vbat-supply = <&wl_bt_reg>; device-wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>; host-wakeup-gpios = <&gpio3 1 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; @@ -598,17 +625,11 @@ skomer_cfg1 { ste,config = <&gpio_in_pd>; }; }; - wlan_en_default_mode: wlan_en_default { - skomer_cfg2 { - pins = "GPIO215_AH13"; - ste,config = <&gpio_out_lo>; - }; - }; }; bluetooth { bluetooth_default_mode: bluetooth_default { skomer_cfg1 { - pins = "GPIO199_AH23", "GPIO222_AJ9"; + pins = "GPIO199_AH23"; ste,config = <&gpio_out_lo>; }; skomer_cfg2 { @@ -617,6 +638,26 @@ skomer_cfg2 { }; }; }; + /* GPIO that enables the WLAN and Bluetooth internal LDO regulators */ + wlan-bt-ldo { + wlan_bt_ldo_en_default: wlan_bt_ldo_default { + /* GPIO222 BT_VREG_ON */ + skomer_cfg1 { + pins = "GPIO222_AJ9"; + ste,config = <&gpio_out_lo>; + }; + /* + * HACK: this is the WL_RESET line that technically has nothing + * to do with the regulator, but in order for the SDIO card + * to enumerate, this must be driven high, so we need to do + * that here. + */ + skomer_cfg2 { + pins = "GPIO215_AH13"; /* RESET_N */ + ste,config = <&gpio_out_hi>; + }; + }; + }; vibrator { vibrator_default: vibrator_default { skomer_cfg1 { -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel