Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp713127pxv; Thu, 15 Jul 2021 14:11:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkkPLOykQazOec5IHzYfts7Hsu4nppXT9nOGTMp7pyqYKa98c2dKsT1pYFVxBRPDoU32/k X-Received: by 2002:a17:906:8683:: with SMTP id g3mr7846520ejx.126.1626383517351; Thu, 15 Jul 2021 14:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383517; cv=none; d=google.com; s=arc-20160816; b=LtSQFv6WRkwxTsM3ksCwYd9i4HfBmGyhNghw0viyiBQwhTulcwavXsjBZOIuuH/Poy HBX9U10JyKMktkNqT0BG2sR34M+VPL3Y9HdDw1HejY6zaoA8Y91IrrxL5cm7tfxtXffV ctsQrxZV+oYvL7Tofsm6yn2zCLqSPrAzl7XV0ds8xSt8Fi2ntu4FNbiC5mSFRw/mB5la D4CsuAjnJd+xwvH03Mm8DaRw2JP9Pyzc/I7ka5YiLm/4+1YD21BDzFyO4agNJtGN1iFU xWHSCGN7PANrCrzOv0nYrehLaqKjb7sWPdq2/m1HBLuSBrDHAYx1UwwOIvGmrPlde2GL 5EQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2f69lu15aLnSFRHiMlAKkeTZsdM+KJ1MTD/kc2nNUcs=; b=h+3/4Dhd9DIOh6jFyLzLWvIWzQmROaO+oXA9U5GfVUbZjkGlAkWm979GEomcFiXrZC d80qcx+/jZbvzZHJM3aQsJyCmOd4Ym+Ah1zg4yRlBxZAOvhf7N9OjiDipbGlT0bXLD/x LTaAdUk3CKaMiGLI8yMmzSLMzc2EHhnU6ZtkZUwGNyEnKNnNOn1vNrMm+bi5l6G3CQRB 9sgEQxzjn2lyjRDHRmYGQL4/d82PH5YVSBy+xMMZI3YMF3Tl4ot42OY1vkeR5ovFIrKL fHa+E/w2UxsOdd+YDCJw6i/IgRU1BK/0PHjgi37Lcs9joikHlRbC7j45tVS7d6/hkOmZ OJJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHFh+Y26; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si8723082edx.413.2021.07.15.14.11.34; Thu, 15 Jul 2021 14:11:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHFh+Y26; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344618AbhGOT37 (ORCPT + 99 others); Thu, 15 Jul 2021 15:29:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243959AbhGOTK0 (ORCPT ); Thu, 15 Jul 2021 15:10:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8289361158; Thu, 15 Jul 2021 19:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376043; bh=NQy8nTnLvXU/vhv4B5FMdCwgkqRgd+S+GC6IS4N4NfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHFh+Y26oC9M1uy8oiPLNQCgXeOHwtbiOB65WL8xQCIGkFBD+hbUTODV34XwMK0Ug DfYgowtYasmUxpw/vUrNptEt34l0JR66KvrpRC+8Y2gVZVJKf7BLiZ4N6fbkM3i91f xOR6rnizshWAMyqSX4mD2BPcaeZZXOgmHdKbxm/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carl Philipp Klemm , Tony Lindgren , Kalle Valo , Sasha Levin Subject: [PATCH 5.13 101/266] wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP Date: Thu, 15 Jul 2021 20:37:36 +0200 Message-Id: <20210715182631.843668500@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Lindgren [ Upstream commit 11ef6bc846dcdce838f0b00c5f6a562c57e5d43b ] At least on wl12xx, reading the MAC after boot can fail with a warning at drivers/net/wireless/ti/wlcore/sdio.c:78 wl12xx_sdio_raw_read. The failed call comes from wl12xx_get_mac() that wlcore_nvs_cb() calls after request_firmware_work_func(). After the error, no wireless interface is created. Reloading the wl12xx module makes the interface work. Turns out the wlan controller can be in a low-power ELP state after the boot from the bootloader or kexec, and needs to be woken up first. Let's wake the hardware and add a sleep after that similar to wl12xx_pre_boot() is already doing. Note that a similar issue could exist for wl18xx, but I have not seen it so far. And a search for wl18xx_get_mac and wl12xx_sdio_raw_read did not produce similar errors. Cc: Carl Philipp Klemm Signed-off-by: Tony Lindgren Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210603062814.19464-1-tony@atomide.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ti/wl12xx/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 9d7dbfe7fe0c..c6da0cfb4afb 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c @@ -1503,6 +1503,13 @@ static int wl12xx_get_fuse_mac(struct wl1271 *wl) u32 mac1, mac2; int ret; + /* Device may be in ELP from the bootloader or kexec */ + ret = wlcore_write32(wl, WL12XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); + if (ret < 0) + goto out; + + usleep_range(500000, 700000); + ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); if (ret < 0) goto out; -- 2.30.2