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: 10246031 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 D65EB602DC for ; Tue, 27 Feb 2018 20:48:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C558A2873D for ; Tue, 27 Feb 2018 20:48:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B95E428746; Tue, 27 Feb 2018 20:48:15 +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 36CD02873D for ; Tue, 27 Feb 2018 20:48:15 +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=TMFavrny+sYXbg4Jy+MexJ6Uoz1lgE1PckOSP3TdNJk=; b=ojw TCohU70Db5y7J+iUNdlsiKYeRF/bsD7trDpTg+BC2CIofILnh4HgjWBr2S5J7DOmhS8XEZrZTJiIa Qtd8McI0op1EDABHQvYdVJKaVCw+V9W93QEVCy974t3/kwO3JJF0Iq/S7m8xxNVIc5EPTBwNhZJL5 BXiyhYC0PA41vhZV6AMKuIacElXN0LnnoUXg4E1UZU8Q0EUbNhbs50zuXDRzMdL9vVast92IwCc1O /ydq5BS9OeFx0BBRZZWKYKQEBIZqlc7mRZdc+US4zs2klpOB4uftgCb4UMnlLTt8kr8XHfrt+UKi1 +rfDQ+X5UgCFOxLIJZ/ZZxCExw1WhRQ==; 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 1eqmAU-0000lo-US; Tue, 27 Feb 2018 20:48:10 +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-0000SS-IR for linux-rockchip@lists.infradead.org; Tue, 27 Feb 2018 20:47:47 +0000 Received: by mail-pg0-x242.google.com with SMTP id g12so73660pgs.0 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=d87jdC4K2yf+9knQNb0M1l2XUzNzp6kirmxEGFGM21aC574O9wNJY32bbwkJfvRTsn yUZJJ1PXq74FSgy8UEXrcHds7BtCJyDsX0Eek66xnkGvl3zB9b4w1/tgIrv+1MOa5RpJ aim4/HqL+HjTV7du+uuiLt+g9jvvSsc60TcyqMYBOL0141DuV/h2T+fME7PEUc9wrQyA WRj27APim5zSreDbRR1t7k8J57QaxKwRcKFRViIPlUZPRpsENm5Cw08PXLXIP+tjvJYz feGrdBqfwmyHrg1AvizZH0a6ffRCjCOVPmRY8H+6JZ/FyHOVA3MOAOMpprFayN8skuGf cxKA== X-Gm-Message-State: APf1xPCR5bP449H4G3ZsATkDqTZzzjKFEOwTDeitpp4L9akyKt/5OOwm XiN2QqfvkngqgsXQx7PI8bjaxw== 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_639552_36EF9D98 X-CRM114-Status: GOOD ( 20.93 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=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 {