Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2339215imm; Mon, 28 May 2018 06:20:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQsDe3dT24ovd3cIGDHkn/k5Vt5buyrdUM13gwY0UkhUt1nqcXjWuxNeJ/023A62nIinfy X-Received: by 2002:a65:4306:: with SMTP id j6-v6mr10689311pgq.341.1527513629574; Mon, 28 May 2018 06:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513629; cv=none; d=google.com; s=arc-20160816; b=fEEmNgRVWfP47pG2wHkcff3VUgxv+cGSAEtNm1D47s+vp8AyVOGAwpOBir8Qj8Rpx4 OlI3kn/z6OX7lDnVw+2i/2k3dSxwnRNys6UPjKC1iDVnLDzKKTIQ3OXitXOgdtt+X2IX nSihcOUYoy6dCpRkP9PhH4vOylI7MeNsjvWQ5zDuHhn051+EcW1eY3VO7Td2Tw+6JPwL nu5dUY5+32VydhjmAxxFegv34ygfpqO/ywJ3d+PfbghIZOvlA59+fognRLvb3nCmmOuG 7yjeMBRHbvm3Fp42s9XOubAiDO/d+pCUyujYvL14D3rq1suBx8k7/tXOYjopOivpsA6M X7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=drbcrXWbs4NWzQeHo1mzSMnH3aIxg8nLzIaaBP0Ntso=; b=sV4Z8Fay9b70xei8YjBCJ8FS2q/YN+hqErbyLgwGiN/iYo0e5ek0pXsc9mhGsR3Es/ 2JyCeppnYkwF4ylm9yahz5Mp7J8cMghSY8S8kr9Wr0gQsFnQHEYwTLWpIJGUk5vrwuYx k9AnmyLxMU6amOdN8KYH2Vv+XzP7d4BqDwUCuaXEJRMlXE5EGB6r039g3ym/uvXK3EXd U630hfmBmO/aqOZrI1YorZuX0Y3qvPr2iv8qzwc8pUyDFQAEkDycpGrLpRa7XTpRFlTa WiKE2ERz6EPfQQZ7hEJ9hOMJssTiF6p6eyWonQ3zdkEfnPg2bUL4cwHjBcIdH4+lXwSt hoLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eWuWL5e8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30-v6si1907067plf.596.2018.05.28.06.20.14; Mon, 28 May 2018 06:20:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eWuWL5e8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165241AbeE1NTf (ORCPT + 99 others); Mon, 28 May 2018 09:19:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:39290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163541AbeE1Kth (ORCPT ); Mon, 28 May 2018 06:49:37 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5CBD20660; Mon, 28 May 2018 10:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504576; bh=JRciQP4qMdgpi53gLeSt1Sb+4vFaLduf8sX9cGRzpYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWuWL5e8AjGTGgBUfEr8nP2tltrLo+l0pTWkXEhvwZtQtf2Eho1hhHZZsB8UgEimB 1rHM47KfJdj5f93AiygXGvshQwt3/KHyh9LSRM/j81pbaTQADo1SzRU5mmND5LkWVd C6jc9pdlrtjJBjF44f7N72NpNicQ6UOeMPhvRCvg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Douglas Anderson , Enric Balletbo i Serra , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.14 189/496] arm64: dts: rockchip: Fix rk3399-gru-* s2r (pinctrl hogs, wifi reset) Date: Mon, 28 May 2018 11:59:34 +0200 Message-Id: <20180528100327.914885708@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Douglas Anderson [ Upstream commit 2560da49de5d0cfec22e9564023aebfffa094732 ] 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 Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) --- 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>; @@ -940,12 +941,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 { @@ -1125,12 +1120,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 {