Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp641282pxv; Thu, 15 Jul 2021 12:14:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnagmzdj9geB79LuQVW3YR1tuMiDVKok2RpDE5JFOBU6zWLN+vrevDWy+UW0eMKDGaGyPb X-Received: by 2002:aa7:c412:: with SMTP id j18mr8881535edq.119.1626376447775; Thu, 15 Jul 2021 12:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376447; cv=none; d=google.com; s=arc-20160816; b=HSSwszMUHFrhywbzQHbwudzePDl6wgNY3XSRS0etAg4lcAN1QC8GH/1LZq071qxtli cn3bLcmQLPK6hdkcGswjt3bWwwmYXaWx/GzUrApLM6JTKvaCnFrOPgychcaoyTawtx00 Vp03ZftFglQV9tpfwf1YZz8b/mTpwLooO1RqfNA5ubP9oNL+zvozHn0+mx5KSxjpjIS9 pDykWJ1OWLx2SLySQtSXci6aKJape+Luu3HK8O59nLczS66vrXBnYVzsm+VAOCVFHYjM yn+aQpIW3kHmXunFh5zFuAVhkifEr+ecS05WiFc8t4+jENbiRXkn0hMbrb30cH/8ptOz +GXw== 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=pgqGUkxjx/jyyvkY4suedXYlBAveZdbxFoRBq+4UEgYHeBF6/Fl2wQ1aJ70MdG+etZ /8aZ2QI0sJJMl7HqlRHijCfoCaTqsUIc9EBX1pzXSTcM3K8qW3AyMJJFhNM8kwlsyB6T Merm3Lcd2n6xCaMxhLses2u3ogzDPrHO8hrNvK0FpjPRph/HjZtRArGSikf0Ch0/t4Fg 2oUiuKFh/M6EDASwhDx71twwMzj5bD59q8+0giTY/CtzBbaveQYL0r4Zya5a381vkbCR 51qtVvxbkj/8200iHa2hJsYYtxoYG0o0CLB0P4ATEzSRTkCOp0OPMS3I1zYsS46z2A/m fv5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=boCjb+OO; 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 z26si7969817ejx.207.2021.07.15.12.13.42; Thu, 15 Jul 2021 12:14:07 -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=boCjb+OO; 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 S243924AbhGOTMU (ORCPT + 99 others); Thu, 15 Jul 2021 15:12:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:34728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243092AbhGOTAM (ORCPT ); Thu, 15 Jul 2021 15:00:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9820D60D07; Thu, 15 Jul 2021 18:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375438; bh=NQy8nTnLvXU/vhv4B5FMdCwgkqRgd+S+GC6IS4N4NfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=boCjb+OOCfVihCPrN1Q3T7CgB4D0vvr5wllfzVUBjH4eAMLIy5lai93LbZ2sGe4tR 0Bpfci1Peh5R86SKHJSezcb0Og90xulLDgr95OmEtt7LwbRbRhtmLolWhTrWihMEFL mGqeWn6J3Kqb8t1x6WiYmNh0u4/vV5g+2vNVmXu0= 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.12 087/242] wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP Date: Thu, 15 Jul 2021 20:37:29 +0200 Message-Id: <20210715182608.344023654@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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