Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6305737imu; Mon, 21 Jan 2019 06:43:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN7TPfuXhdTvKmsDZUtt6z7l8bpDNn4Oj1MO83ultU9nRgcnCM0bIAL5wZ+LgKt0zEf2AHr5 X-Received: by 2002:a63:7306:: with SMTP id o6mr27845084pgc.343.1548081823953; Mon, 21 Jan 2019 06:43:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548081823; cv=none; d=google.com; s=arc-20160816; b=iQD9UDEUSeqM3ani/BJ875zh0Ukg2MbNljEZmKNPXe5Ch6QN0AXvjw6uxjjbJ49AdU KuYKSB5yfQzjQwgdy1Pc1ZwBiyN/nnCT9wsMRDGQg8KnP9E+ujrswxlTic4BjcX+wkP6 rrelZln7eIE+yMNzPuNZGKKYo4HMPcY6ZlDzTUbOTwgW3UVgfm0G59Niwqj0ap9hBzkK ymeYdybNpVbWBviBcI8I8Wi6g+C7v8htgylPzuaaTF9gdicjwSM/k+adZKpsYlTQwlGQ XAM4bwrMChYXYD+ZFEbzmD8Ks47jEhKfhyZiKmCbEb8wwd43/ZyGXRLqEJ4Mq4O4zNJW Sl6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Kqmp7wi8kNIRbVhXAsqOXat4glJcWecSXxhkinoXM38=; b=Vrhl+2ujLvf7v5BDftbPiOnkQheNEvzDflhn+WqGmea4/h7R6iYEto/UzDrl/cqTJm 9zubCpQp6mDQpwFhGeUXwhOdg363huIx3yQBRiDkiYzzQ6dU2SIj4M/tY2aHzOpTsHET fep86Xgsjdp0/CL/1GzsvfPMWBhsN2x9P1J7ij+gdcSVV8OTrNdh3k+uGgEJJ85R8pHK i3ZwTL/wrOgvJ27aVJMwLwiPqLgonqDWEVk8MdI53WVpzodWm6MURCQuC9Yztnn9AA8X qicVnx5juj6YVykKbv+WZoFEIpkucHPgstUrzjCGDt2npASfhg9LMRtR0c58erRC/6xH k0rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TlOP649D; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si715546pgn.325.2019.01.21.06.43.28; Mon, 21 Jan 2019 06:43:43 -0800 (PST) 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=@linaro.org header.s=google header.b=TlOP649D; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729371AbfAUOlR (ORCPT + 99 others); Mon, 21 Jan 2019 09:41:17 -0500 Received: from mail-ua1-f65.google.com ([209.85.222.65]:43440 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729200AbfAUOlR (ORCPT ); Mon, 21 Jan 2019 09:41:17 -0500 Received: by mail-ua1-f65.google.com with SMTP id z11so6956354uaa.10 for ; Mon, 21 Jan 2019 06:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Kqmp7wi8kNIRbVhXAsqOXat4glJcWecSXxhkinoXM38=; b=TlOP649DDcYkneTBnWDrwS8E/TSYICZpmABMI9rW2ZnAiDlAslZwO9fUn7apYT/VuN iAndVc1qQb/g7DjccHL/FZxHmO6uXbelX2RNaRX4c1TxO90S/SyVquPNEypiNcfw0+Ns tzTV92iG29n3Na9SE/Q32YndIghyCe+PgsX+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Kqmp7wi8kNIRbVhXAsqOXat4glJcWecSXxhkinoXM38=; b=RmhuIxw7bM18SJcypStxnAEBi0LjRZ4WAFYUvvlyw2wyajShfXZ3UiR5osYL5lNwVQ J20zbPK75KR5Oa8lZj1Od5aRPcrbr4sGDQ7hwPjmuIQBRRvsCS3R0shnjYKiNjUAEGz8 4R3cf7V9lsG2pk3GSOTz0ChOREMlGGEona/pIPPnY8b9f825M4wjTgg1MqD5GJo+k8aF ZqOmu3qLlTjcPiCqwiI6zDj879Dyp2qvie6nHTA0C1HMC+uS7OR/u5hhN2D3kOQ4NGSz sStoY6PoarsIzJGROTOnOVQzjxByvnt+HEUMhph0D9CX/NdSg3blMFqRSBry1/78o3+c ch4w== X-Gm-Message-State: AJcUukcWSeuVpztaFQrrMnfkTYH/6JWQcabTiAZvaRnA5qY2lA+PeaQZ XQ30g4KDf9zHuCwMob/ZpmeeVdLdffbmIGyjoaMD0A== X-Received: by 2002:ab0:31d5:: with SMTP id e21mr12108721uan.107.1548081675413; Mon, 21 Jan 2019 06:41:15 -0800 (PST) MIME-Version: 1.0 References: <20190116113723.15668-1-ulf.hansson@linaro.org> <258ecb6b-c2b2-c8b8-9804-4df69002d9f5@web.de> <5bf8514a-eb15-b098-1857-835b36d4a67c@web.de> In-Reply-To: From: Ulf Hansson Date: Mon, 21 Jan 2019 15:40:38 +0100 Message-ID: Subject: Re: [PATCH V2] wlcore: sdio: Fixup power on/off sequence To: Jan Kiszka Cc: Kalle Valo , Tony Lindgren , Eyal Reizer , linux-wireless@vger.kernel.org, Ricardo Salveti , Kishon Vijay Abraham I , Anders Roxell , John Stultz , Linux Kernel Mailing List , linux-omap Content-Type: multipart/mixed; boundary="00000000000058e291057ff8da6b" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000058e291057ff8da6b Content-Type: text/plain; charset="UTF-8" On Fri, 18 Jan 2019 at 16:09, Ulf Hansson wrote: > > On Fri, 18 Jan 2019 at 13:09, Jan Kiszka wrote: > > > > On 17.01.19 10:54, Ulf Hansson wrote: > > > On Wed, 16 Jan 2019 at 21:26, Jan Kiszka wrote: > > >> > > >> On 16.01.19 12:37, Ulf Hansson wrote: > > >>> During "wlan-up", we are programming the FW into the WiFi-chip. However, > > >>> re-programming the FW doesn't work, unless a power cycle of the WiFi-chip > > >>> is made in-between the programmings. > > >>> > > >>> To conform to this requirement and to fix the regression in a simple way, > > >>> let's start by allowing that the SDIO card (WiFi-chip) may stay powered on > > >>> (runtime resumed) when wl12xx_sdio_power_off() returns. The intent with the > > >>> current code is to treat this scenario as an error, but unfortunate this > > >>> doesn't work as expected, so let's fix this. > > >>> > > >>> The other part is to guarantee that a power cycle of the SDIO card has been > > >>> completed when wl12xx_sdio_power_on() returns, as to allow the FW > > >>> programming to succeed. However, relying solely on runtime PM to deal with > > >>> this isn't sufficient. For example, userspace may prevent runtime suspend > > >>> via sysfs for the device that represents the SDIO card, leading to that the > > >>> mmc core also keeps it powered on. For this reason, let's instead do a > > >>> brute force power cycle in wl12xx_sdio_power_on(). > > >>> > > >>> Fixes: 728a9dc61f13 ("wlcore: sdio: Fix flakey SDIO runtime PM handling") > > >>> Signed-off-by: Ulf Hansson > > >>> --- > > >>> > > >>> Changes in v2: > > >>> - Keep the SDIO host claimed when calling mmc_hw_reset(). > > >>> - Add a fixes tag. > > >>> --- > > >>> drivers/net/wireless/ti/wlcore/sdio.c | 15 +++++++-------- > > >>> 1 file changed, 7 insertions(+), 8 deletions(-) > > >>> > > >>> diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c > > >>> index bd10165d7eec..4d4b07701149 100644 > > >>> --- a/drivers/net/wireless/ti/wlcore/sdio.c > > >>> +++ b/drivers/net/wireless/ti/wlcore/sdio.c > > >>> @@ -164,6 +164,12 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) > > >>> } > > >>> > > >>> sdio_claim_host(func); > > >>> + /* > > >>> + * To guarantee that the SDIO card is power cycled, as required to make > > >>> + * the FW programming to succeed, let's do a brute force HW reset. > > >>> + */ > > >>> + mmc_hw_reset(card->host); > > >>> + > > >>> sdio_enable_func(func); > > >>> sdio_release_host(func); > > >>> > > >>> @@ -174,20 +180,13 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) > > >>> { > > >>> struct sdio_func *func = dev_to_sdio_func(glue->dev); > > >>> struct mmc_card *card = func->card; > > >>> - int error; > > >>> > > >>> sdio_claim_host(func); > > >>> sdio_disable_func(func); > > >>> sdio_release_host(func); > > >>> > > >>> /* Let runtime PM know the card is powered off */ > > >>> - error = pm_runtime_put(&card->dev); > > >>> - if (error < 0 && error != -EBUSY) { > > >>> - dev_err(&card->dev, "%s failed: %i\n", __func__, error); > > >>> - > > >>> - return error; > > >>> - } > > >>> - > > >>> + pm_runtime_put(&card->dev); > > >>> return 0; > > >>> } > > >>> > > >>> > > >> > > >> Just tested on both HiKey (620) and Ultra96 but it fails to fix the issue on > > >> both. I'm getting > > >> > > >> wl1271_sdio: probe of mmc2:0001:1 failed with error -16 > > >> > > >> during boot again, and the interface is not available. > > > > > > Okay, sounds like this may be a different problem then. Can you share > > > the complete log and the kernel config? > > > > You can find the config here [1], log from the HiKey boot attached. > > > > > I can prepare a debug patch as well, if you are willing to re-run the test? > > > > Sure, send it over, I can run it. > > Alright, sounds great. However, I need to defer that to Monday/Tuesday > next week. > > > > > > > > > Adding a post-power-on-delay-ms of 1 ms as you suggested [1], doesn't > > > sounds like the correct solution to me, unless I am overlooking some > > > things. The point is, since the mmc core succeeds to detect and > > > initialize the SDIO card, the power sequence seems to be correct. > > > > Yeah, I'm not claiming at all I know what I'm doing there, just that it happens > > to work. > > I see. Good to know, thanks! > > > > > Jan > > > > [1] > > https://github.com/siemens/jailhouse-images/blob/next/recipes-kernel/linux/files/arm64_defconfig_4.19 > > I have looked through the log and the defconfig. No obvious things > found at this point. Thanks for sharing them! > So, I have put together a debug patch, mostly to verify that things seems to be correct in regards to runtime PM. It should produce some prints to the log, particular during power on/off of the SDIO card and during probe of the wifi driver. Please re-run the test on top of the v2 version of the $subject patch. Kind regards Uffe --00000000000058e291057ff8da6b Content-Type: text/x-patch; charset="US-ASCII"; name="0001-wlcore-sdio-mmc-Debug-for-runtime-PM-and-power-on-of.patch" Content-Disposition: attachment; filename="0001-wlcore-sdio-mmc-Debug-for-runtime-PM-and-power-on-of.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jr6ftz4w0 RnJvbSBlZjc4OTA0NjNhZTliZWM4ZmFiN2QxNjQ0ODY4MTkyMzczNjcwNmUzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBVbGYgSGFuc3NvbiA8dWxmLmhhbnNzb25AbGluYXJvLm9yZz4K RGF0ZTogTW9uLCAyMSBKYW4gMjAxOSAxNTozMTo1NyArMDEwMApTdWJqZWN0OiBbUEFUQ0hdIHds Y29yZS9zZGlvL21tYzogRGVidWcgZm9yIHJ1bnRpbWUgUE0gYW5kIHBvd2VyIG9uL29mZiBvZgog U0RJTwoKU2lnbmVkLW9mZi1ieTogVWxmIEhhbnNzb24gPHVsZi5oYW5zc29uQGxpbmFyby5vcmc+ Ci0tLQogZHJpdmVycy9tbWMvY29yZS9wd3JzZXFfc2ltcGxlLmMgICAgICB8ICAyICsrCiBkcml2 ZXJzL21tYy9jb3JlL3NkaW8uYyAgICAgICAgICAgICAgIHwgMTkgKysrKysrKysrKysrKysrKyst LQogZHJpdmVycy9tbWMvY29yZS9zZGlvX2J1cy5jICA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