Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1078879ybc; Sat, 23 Nov 2019 14:46:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxhYugjOQ3gMsp87w17gxvsvYdjRpHMehxdgMCIaV3Vf9rG7nFWIXb9fFiIBMusw+WHcaN/ X-Received: by 2002:a17:906:d9c4:: with SMTP id qk4mr28219862ejb.214.1574549191399; Sat, 23 Nov 2019 14:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574549191; cv=none; d=google.com; s=arc-20160816; b=TY3hfZuoMUbq8pH7N/olAK1PcfmBOdyzO1HRJQ3lEGhrG8GxZzKIKdH+UXBuQ0eEB0 ZbWGJIv5gjKAWzEGC73Ws01c82qQsCn0zQoOazHbJYb3rYytUqIvqdcKjVFlUnstPn9u 5p8UX2aJZeIKbvcRTa3hfGXozvJ0/aMxi4IuMSsjrjhWGWtQw67giWY/8xdiXVjWQrTR AvZE35fAA9f4dIHNa0t82NuTjLuR3N66IxvpFxJIbWdE+P11EjDZvlpnxTFglGyXso10 gVc8ha2ye2vh/X7Z3zc57/IYy/Enz2hy5CFY5bQYy1xS7rn90CsfaJugTFI97q0bnLB2 zHnQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=4O7TczW7O+TMmvDDF57PIlDkWIs8n3CJ3D7IMd7pi+U=; b=FoLsW0mjiSolmv+nkAwBvpSDJ8zVO4GRvLW9vn+ZswGyH4XS+HZHNu1ELSN+LQFBr7 yhc+XR4eB4CTWY0uAyAm0NUlVCuDxJ5kq3P+l0pZxCaytsMpmBZZNEjuhVpiMf8aMS3c EEaiZEzWa8MsEE4asfNJo8nNsMSW+I4NYByaG5tbxD/mnYVqVTeExNAxqedqyuEuwDQM kPxc+AQMAe5MtgPBUroLsHqOjKtbfc/2Zjqvt0pikKZ6hCfTGZO3vVwwjyjF676CRTsN TXkmLtI8KBkZYSh9AqiOTRiUb9rhJfAm6vHkUghq+FFubx9Wx7CYVo846PLcFsjI6ILi BMMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DQa0fpbS; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si1441745eju.242.2019.11.23.14.45.49; Sat, 23 Nov 2019 14:46:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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=DQa0fpbS; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726813AbfKWWmj (ORCPT + 99 others); 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 Content-Transfer-Encoding: 8bit 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); -- 2.21.0