From patchwork Sat Nov 23 22:42:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 11259011 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CC441390 for ; Sat, 23 Nov 2019 22:43:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4C7720706 for ; Sat, 23 Nov 2019 22:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574549018; bh=uEyNnuYMBvNQHpDK/zx1GEKa6aPWUSeWE/ZuzTB/5Qw=; h=From:To:Cc:Subject:Date:List-ID:From; b=SmVxCuVQMA/7gguiGuq0lzEIxPtYQ6tTdtAB977akF8toXE2zYvvdI0bvyGFudZRu gEasMJD0A/WZMWUtBG55P7z71NwXuo/MLt3RbtXtXIdzUpAgVW3Yh/zGr/+c3DK1W8 3tW51q40OMfOfBfXrWAHPvMFGhVd5oWv89TJKPak= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726820AbfKWWmj (ORCPT ); Sat, 23 Nov 2019 17:42:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:36052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbfKWWmj (ORCPT ); Sat, 23 Nov 2019 17:42:39 -0500 Received: from localhost.localdomain (unknown [77.139.212.74]) (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 228C920706; Sat, 23 Nov 2019 22:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574548958; bh=uEyNnuYMBvNQHpDK/zx1GEKa6aPWUSeWE/ZuzTB/5Qw=; h=From:To:Cc:Subject:Date:From; b=DQa0fpbS9MY+veAApVu4F415hFUYYkhyRJpC4JmIlTWocvtZFmLoUjwSV+yCuv+G9 /BZyLE5Xl5s2SzP7KpFRd5haf9bdqCV5qkBxuiLSAmeFzByuMlhfyL2UjN25zilI31 0jCR5ejIlJrJRgYRkce3H+RE1no41b2IQKEbptaY= From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, kevin.patrick.schmidt@googlemail.com Subject: [PATCH] mt76: mt76x0: fix default mac address overwrite Date: Sun, 24 Nov 2019 00:42:22 +0200 Message-Id: <567a7cda15f641acb6eab5970370c9bfac96793e.1574548832.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Current implementation always use default eeprom mac address to configure device registers even if it is updated using mt76_eeprom_override. Fix it initializing macaddr filed of mt76_dev data structure with eeprom mac address and running mt76_eeprom_override before mt76x02_mac_setaddr Fixes: d1bc9bf2072c ("mt76: mt76x0: eeprom: add support for MAC address from OF") Tested-by: Kevin Schmidt Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c index a03e2d01fba7..d1405528b504 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c @@ -342,8 +342,11 @@ int mt76x0_eeprom_init(struct mt76x02_dev *dev) dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n", version, fae); - mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR); + memcpy(dev->mt76.macaddr, (u8 *)dev->mt76.eeprom.data + MT_EE_MAC_ADDR, + ETH_ALEN); mt76_eeprom_override(&dev->mt76); + mt76x02_mac_setaddr(dev, dev->mt76.macaddr); + mt76x0_set_chip_cap(dev); mt76x0_set_freq_offset(dev); mt76x0_set_temp_offset(dev);