From patchwork Tue Feb 27 20:47:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10246029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC8CE602DC for ; Tue, 27 Feb 2018 20:47:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBD9C27F8C for ; Tue, 27 Feb 2018 20:47:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B06522818E; Tue, 27 Feb 2018 20:47:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4369F27F8C for ; Tue, 27 Feb 2018 20:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=4zRgfBnfABnHMrNJkD00Sd5Bg1tX3HBUaV9zPvFjNC0=; b=WHJ 8PF9X2wYeRLdQ642YHVk5NwwD5//q6O0PDgmeuNlQGmhrQmGcxPZnnwtWt7hUDdu2Kb+3Hln7IBZb 85AT0QoplkeKLCTn0wxDQ8qjJlYgktkE94EEnqg3AWJu2EfjxNTkOt6wUo3W0Np69OAP/0IB9vFwC BdBhxHbWbWFxYVt1u8PJpUemM0wYFdk7G/zMpBms23U8DAVoLpHQLQjC7GicJNMBkOXPV//JZrpfY w+MZTUjU2EOL547Wmr5tUqmEE9VWSZ2djU+5yVZAtbhJAEQdRhR322kT0KC+atptDtp3KG8ZTMCGa t2xC46mFzDnNzy2A0UF+qfM2pYyi7Fw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqmA9-0000VE-MI; Tue, 27 Feb 2018 20:47:49 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqmA5-0000ST-I5 for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2018 20:47:47 +0000 Received: by mail-pg0-x242.google.com with SMTP id g2so66041pgn.7 for ; Tue, 27 Feb 2018 12:47:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=ShbCxfYCSCtZ8Traevl5kSJNmV6c8QnTV8vr5bLxkNE=; b=GACEHR8xvbo52nuxUwtRG3QRkQVf5Vfm/t7AaBQoC2+PREzY/HLrycnvCSYZeuztwM LM+zAyQ5wUG30GC0KcUvwAn6jg8eT7+1vr9Tz70vjkHkwXdUR0DEYRYIbZvIBNmbK50J uLFCoZ4zcxEr8I0LjlUMdar+D0cAZ0X2AHZL0= 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; bh=ShbCxfYCSCtZ8Traevl5kSJNmV6c8QnTV8vr5bLxkNE=; b=nGeVc/K4hquzYOVdoMDsnvns35yTcnsyLiOthJitgSvcP2ZFfabT/Ga8msTmzmliKT kWaKNgHMhGIxKZhM50ZMuvuJVDhICUOpmZgPIqlWkvLE4JHYXyM3JxWP8eVYOEEDD8ZQ jRvFOo+ErbO0wXHxz401HeGKeWqa7XhQvGooHhYF+qC+86iJFxEA5B1uOFPkudY6SN3d IA7my4A0qsrXrLPkoSOB1RIjqr6Tn8uBDoVMrMtY9pbUa26lo1/xMW+ycwCu1UZoISpw AElRADzviLdcDAXx0lxHdyFVQTnZAXfWALfYo1rFFCcYgjCPnsjJ7Pd8Y71uIMIODOA6 119Q== X-Gm-Message-State: APf1xPCcwCZllzGUirGRDc2O3bIAiZpmPCsc6fxDRwklZktfdj4FHwrm L3CZVh9GI7DbHKPEB7z54H0t5g== X-Google-Smtp-Source: AH8x224LK25pusgWH+ozTupxzIPzOK+La3jW0hK+3+1elGG8mG36rVtvO33CqFHMxulJ7lkdFdXG8g== X-Received: by 10.99.104.73 with SMTP id d70mr12145810pgc.107.1519764453741; Tue, 27 Feb 2018 12:47:33 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:0:1000:1501:38e4:86fe:ec0c:4007]) by smtp.gmail.com with ESMTPSA id a28sm38025pfe.70.2018.02.27.12.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 12:47:32 -0800 (PST) From: Douglas Anderson To: Heiko Stuebner , Brian Norris Subject: [PATCH] arm64: dts: rockchip: Fix rk3399-gru-* s2r (pinctrl hogs, wifi reset) Date: Tue, 27 Feb 2018 12:47:11 -0800 Message-Id: <20180227204711.29357-1-dianders@chromium.org> X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_124745_643827_CB78E77D X-CRM114-Status: GOOD ( 22.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Florian Fainelli , Marc Zyngier , Catalin Marinas , Linus Walleij , Jeffy Chen , Will Deacon , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Matthias Kaehlcke , Enric Balletbo i Serra , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Back in the early days when gru devices were still under development we found an issue where the WiFi reset line needed to be configured as early as possible during the boot process to avoid the WiFi module being in a bad state. We found that the way to get the kernel to do this in the earliest possible place was to configure this line in the pinctrl hogs, so that's what we did. For some history here you can see . After the time that change landed in the kernel, we landed a firmware change to configure this line even earlier. See . However, even after the firmware change landed we kept the kernel change to deal with the fact that some people working on devices might take a little while to update their firmware. At this there are definitely zero devices out in the wild that have firmware without the fix in it. Specifically looking in the firmware branch several critically important fixes for memory stability landed after the patch in coreboot and I know we didn't ship without those. Thus, by now, everyone should have the new firmware and it's safe to not have the kernel set this up in a pinctrl hog. Historically, even though it wasn't needed to have this in a pinctrl hog, we still kept it since it didn't hurt. Pinctrl would apply the default hog at bootup and then would never touch things again. That all changed with commit 981ed1bfbc6c ("pinctrl: Really force states during suspend/resume"). After that commit then we'll re-apply the default hog at resume time and that can screw up the reset state of WiFi. ...and on rk3399 if you touch a device on PCIe in the wrong way then the whole system can go haywire. That's what was happening. Specifically you'd resume a rk3399-gru-* device and it would mostly resume, then would crash with some crazy weird crash. One could say, perhaps, that the recent pinctrl change was at fault (and should be fixed) since it changed behavior. ...but that's not really true. The device tree for rk3399-gru is really to blame. Specifically since the pinctrl is defined in the hog and not in the "wlan-pd-n" node then the actual user of this pin doesn't have a pinctrl entry for it. That's bad. Let's fix our problems by just moving the control of "wlan_module_reset_l pinctrl" out of the hog and put them in the proper place. NOTE: in theory, I think it should actually be possible to have a pin controlled _both_ by the hog and by an actual device. Once the device claims the pin I think the hog is supposed to let go. I'm not 100% sure that this works and in any case this solution would be more complex than is necessary. Reported-by: Marc Zyngier Fixes: 48f4d9796d99 ("arm64: dts: rockchip: add Gru/Kevin DTS") Fixes: 981ed1bfbc6c ("pinctrl: Really force states during suspend/resume") Signed-off-by: Douglas Anderson Tested-by: Enric Balletbo i Serra Tested-by: Marc Zyngier --- arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi index 6e50768a34ce..9ad54751d0d8 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi @@ -406,8 +406,9 @@ wlan_pd_n: wlan-pd-n { compatible = "regulator-fixed"; regulator-name = "wlan_pd_n"; + pinctrl-names = "default"; + pinctrl-0 = <&wlan_module_reset_l>; - /* Note the wlan_module_reset_l pinctrl */ enable-active-high; gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>; @@ -988,12 +989,6 @@ ap_i2c_audio: &i2c8 { pinctrl-0 = < &ap_pwroff /* AP will auto-assert this when in S3 */ &clk_32k /* This pin is always 32k on gru boards */ - - /* - * We want this driven low ASAP; firmware should help us, but - * we can help ourselves too. - */ - &wlan_module_reset_l >; pcfg_output_low: pcfg-output-low { @@ -1173,12 +1168,7 @@ ap_i2c_audio: &i2c8 { }; wlan_module_reset_l: wlan-module-reset-l { - /* - * We want this driven low ASAP (As {Soon,Strongly} As - * Possible), to avoid leakage through the powered-down - * WiFi. - */ - rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_output_low>; + rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_pull_none>; }; bt_host_wake_l: bt-host-wake-l {