Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2277995imc; Tue, 12 Mar 2019 10:26:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYuO4HwxzC6ieVLlH3ivNAdTplWeQ/np0+x9YdkVodOKweGbo2INg4rAHfmhwwzRPoMQ5L X-Received: by 2002:a17:902:e784:: with SMTP id cp4mr4528184plb.135.1552411579590; Tue, 12 Mar 2019 10:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552411579; cv=none; d=google.com; s=arc-20160816; b=D4dEyhC5nc7s63kRJBZjVCPbi1LWAVnBEqxCyrdwXyWC6DA4MdhixoAwXmWAmhrbod EQponxSsK8QKmY7qdMWKsH+usn2peu6te8cl3sJ+7TZ8oY4XCvv1TVI28HRSskpzrsRq Zy69J3Pftq7pqqQzEi8TPexhH6jdvjORCucyKhBa2LO2gFanTSmIHkHuAK4soQrDryQe 6I6QCumtSbX2KiS8s+2mPtwfKvJe52ZGAfwBWEBe6zYDyENwofLv3QaGIs/mxElnt+Ni Us4/yea69vMnTbhIwUZ743liDk/kphwuCaB9Zv9Xk22rO+o8xEtpjPZDlG6afdc9Y2tO fxOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U2j9RyBc/ZNF1WUNIKl6wrIGsn5dLMDsfVDLOWbZHz4=; b=W7O/u9Ad8HCBr1/l1RznPMyilPZiqPHrOHiveSjDGXti8OFCKe/YrcBi/iI3spKAlz XEs1m3YDfI0VjNS/nRV2sLhN58zV+t9ENGDUrkcvJZ515cabA/jMb3ZB62VC4TKS8qDI V/EX+qD+r7naEQPSYaGl4x3yoQfEEOajZzY03nmxl3VVVi1tdNGiN0BGn/8Ui2h74DeM pRjxj3B6LlfQXWeQ7o3o+ijONx0vGoFzA+KwIP4k4VARBU1AoiT72WjImyLWBExJvCwz jGPVXPL9QTciKtQVPA3SMCfNUdgmISiDlufIcOPYuRSJoqZPoA9SECeBQ/v/PD3yW+jQ HNlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JMFSCf9U; 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 u1si8350672pfb.193.2019.03.12.10.26.03; Tue, 12 Mar 2019 10:26:19 -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=JMFSCf9U; 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 S1728468AbfCLRSA (ORCPT + 99 others); Tue, 12 Mar 2019 13:18:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:60252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728609AbfCLRRI (ORCPT ); Tue, 12 Mar 2019 13:17:08 -0400 Received: from localhost (unknown [104.133.8.98]) (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 A320F2171F; Tue, 12 Mar 2019 17:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552411027; bh=fIFrTEEK6RJdBZ5sPq5diOLk9Bjr7/XncdOi21SpDn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JMFSCf9US+/wCOZ8NAuRzGnZMov2awj569ejCMpAaTlaz/QfxJafYuKahw8OA5Gjx M5PGljFmP9KqVaFqkk22xhzJu+SXmSZbPjmzlbytlVUUdzrAwAQ5bzDbPnFGvuCVMx bCo708TOancc9wSiUXt/VPrm4XNdK/YVW6Xo9hY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , "Daniel F. Dickinson" , Kalle Valo , Christian Lamparter Subject: [PATCH 4.14 130/135] ath9k: Avoid OF no-EEPROM quirks without qca,no-eeprom Date: Tue, 12 Mar 2019 10:09:37 -0700 Message-Id: <20190312170353.129620428@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170341.127810985@linuxfoundation.org> References: <20190312170341.127810985@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Daniel F. Dickinson commit ce938231bd3b1d7af3cbd8836f084801090470e1 upstream. ath9k_of_init() function[0] was initially written on the assumption that if someone had an explicit ath9k OF node that "there must be something wrong, why would someone add an OF node if everything is fine"[1] (Quoting Martin Blumenstingl ) "it turns out it's not that simple. with your requirements I'm now aware of two use-cases where the current code in ath9k_of_init() doesn't work without modifications"[1] The "your requirements" Martin speaks of is the result of the fact that I have a device (PowerCloud Systems CR5000) has some kind of default - not unique mac address - set and requires to set the correct MAC address via mac-address devicetree property, however: "some cards come with a physical EEPROM chip [or OTP] so "qca,no-eeprom" should not be set (your use-case). in this case AH_USE_EEPROM should be set (which is the default when there is no OF node)"[1] The other use case is: the firmware on some PowerMac G5 seems to add a OF node for the ath9k card automatically. depending on the EEPROM on the card AH_NO_EEP_SWAP should be unset (which is the default when there is no OF node). see [3] After this patch to ath9k_of_init() the new behavior will be: if there's no OF node then everything is the same as before if there's an empty OF node then ath9k will use the hardware EEPROM (before ath9k would fail to initialize because no EEPROM data was provided by userspace) if there's an OF node with only a MAC address then ath9k will use the MAC address and the hardware EEPROM (see the case above) with "qca,no-eeprom" EEPROM data from userspace will be requested. the behavior here will not change [1] Martin provides additional background on EEPROM swapping[1]. Thanks to Christian Lamparter for all his help on troubleshooting this issue and the basis for this patch. [0]https://elixir.bootlin.com/linux/v4.20-rc7/source/drivers/net/wireless/ath/ath9k/init.c#L615 [1]https://github.com/openwrt/openwrt/pull/1645#issuecomment-448027058 [2]https://github.com/openwrt/openwrt/pull/1613 [3]https://patchwork.kernel.org/patch/10241731/ Fixes: 138b41253d9c ("ath9k: parse the device configuration from an OF node") Reviewed-by: Martin Blumenstingl Tested-by: Martin Blumenstingl Signed-off-by: Daniel F. Dickinson Signed-off-by: Kalle Valo Cc: Christian Lamparter Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath9k/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -580,15 +580,15 @@ static int ath9k_of_init(struct ath_soft ret = ath9k_eeprom_request(sc, eeprom_name); if (ret) return ret; + + ah->ah_flags &= ~AH_USE_EEPROM; + ah->ah_flags |= AH_NO_EEP_SWAP; } mac = of_get_mac_address(np); if (mac) ether_addr_copy(common->macaddr, mac); - ah->ah_flags &= ~AH_USE_EEPROM; - ah->ah_flags |= AH_NO_EEP_SWAP; - return 0; }