From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 08/15] mt76: mt7615: add eeprom support for MT7622
Date: Thu, 30 Jan 2020 15:47:11 +0100 [thread overview]
Message-ID: <20200130144718.14298-8-nbd@nbd.name> (raw)
In-Reply-To: <20200130144718.14298-1-nbd@nbd.name>
When sending EEPROM data to the MCU, MT7622 uses a longer buffer
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../net/wireless/mediatek/mt76/mt7615/eeprom.c | 1 +
.../net/wireless/mediatek/mt76/mt7615/eeprom.h | 3 ++-
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 17 +++++++++++------
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
index e4dcfa531a24..3c3570332366 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
@@ -84,6 +84,7 @@ static int mt7615_check_eeprom(struct mt76_dev *dev)
switch (val) {
case 0x7615:
+ case 0x7622:
return 0;
default:
return -EINVAL;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
index c3bc69ac210e..18c7301521b7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
@@ -21,7 +21,8 @@ enum mt7615_eeprom_field {
MT_EE_TX2_5G_G0_TARGET_POWER = 0x142,
MT_EE_TX3_5G_G0_TARGET_POWER = 0x16a,
- __MT_EE_MAX = 0x3bf
+ MT7615_EE_MAX = 0x3bf,
+ MT7622_EE_MAX = 0x3db,
};
#define MT_EE_NIC_CONF_TX_MASK GENMASK(7, 4)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 2352e7687790..e51e584bf81f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -621,18 +621,23 @@ int mt7615_mcu_set_eeprom(struct mt7615_dev *dev)
__le16 len;
} __packed req_hdr = {
.buffer_mode = 1,
- .len = cpu_to_le16(__MT_EE_MAX - MT_EE_NIC_CONF_0),
};
- int ret, len = sizeof(req_hdr) + __MT_EE_MAX - MT_EE_NIC_CONF_0;
+ int ret, len, eep_len;
u8 *req, *eep = (u8 *)dev->mt76.eeprom.data;
+ if (is_mt7622(&dev->mt76))
+ eep_len = MT7622_EE_MAX - MT_EE_NIC_CONF_0;
+ else
+ eep_len = MT7615_EE_MAX - MT_EE_NIC_CONF_0;
+
+ len = sizeof(req_hdr) + eep_len;
req = kzalloc(len, GFP_KERNEL);
if (!req)
return -ENOMEM;
+ req_hdr.len = cpu_to_le16(eep_len);
memcpy(req, &req_hdr, sizeof(req_hdr));
- memcpy(req + sizeof(req_hdr), eep + MT_EE_NIC_CONF_0,
- __MT_EE_MAX - MT_EE_NIC_CONF_0);
+ memcpy(req + sizeof(req_hdr), eep + MT_EE_NIC_CONF_0, eep_len);
ret = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EFUSE_BUFFER_MODE,
req, len, true);
@@ -1285,7 +1290,7 @@ int mt7615_mcu_set_tx_power(struct mt7615_phy *phy)
};
s8 tx_power;
- len = sizeof(req_hdr) + __MT_EE_MAX - MT_EE_NIC_CONF_0;
+ len = sizeof(req_hdr) + MT7615_EE_MAX - MT_EE_NIC_CONF_0;
req = kzalloc(len, GFP_KERNEL);
if (!req)
return -ENOMEM;
@@ -1293,7 +1298,7 @@ int mt7615_mcu_set_tx_power(struct mt7615_phy *phy)
memcpy(req, &req_hdr, sizeof(req_hdr));
data = req + sizeof(req_hdr);
memcpy(data, eep + MT_EE_NIC_CONF_0,
- __MT_EE_MAX - MT_EE_NIC_CONF_0);
+ MT7615_EE_MAX - MT_EE_NIC_CONF_0);
tx_power = hw->conf.power_level * 2;
switch (n_chains) {
--
2.24.0
next prev parent reply other threads:[~2020-01-30 14:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 14:47 [PATCH 01/15] dt-bindings: net: wireless: mt76: document bindings for MT7622 Felix Fietkau
2020-01-30 14:47 ` [PATCH 02/15] mt76: mt7615: add __aligned(4) to txp structs Felix Fietkau
2020-01-30 14:47 ` [PATCH 03/15] mt76: mt7615: move mmio related code from pci.c to mmio.c Felix Fietkau
2020-01-30 14:47 ` [PATCH 04/15] mt76: mt7615: split up firmware loading functions Felix Fietkau
2020-01-30 14:47 ` [PATCH 05/15] mt76: mt7615: store N9 firmware version instead of CR4 Felix Fietkau
2020-01-30 14:47 ` [PATCH 06/15] mt76: mt7615: fix MT_INT_TX_DONE_ALL definition for MT7622 Felix Fietkau
2020-01-30 14:47 ` [PATCH 07/15] mt76: mt7615: add dma and tx queue initialization " Felix Fietkau
2020-01-30 14:47 ` Felix Fietkau [this message]
2020-01-30 14:47 ` [PATCH 09/15] mt76: mt7615: add calibration free support " Felix Fietkau
2020-01-30 14:47 ` [PATCH 10/15] mt76: mt7615: disable 5 GHz on MT7622 Felix Fietkau
2020-01-30 14:47 ` [PATCH 11/15] mt76: mt7615: implement probing and firmware loading " Felix Fietkau
2020-01-30 14:47 ` [PATCH 12/15] mt76: mt7615: implement DMA support for MT7622 Felix Fietkau
2020-01-30 14:47 ` [PATCH 13/15] mt76: mt7615: decrease rx ring size " Felix Fietkau
2020-01-30 14:47 ` [PATCH 14/15] mt76: mt7615: disable DBDC on MT7622 Felix Fietkau
2020-01-30 14:47 ` [PATCH 15/15] mt76: mt7615: add Kconfig entry for MT7622 Felix Fietkau
2020-02-06 18:22 ` [PATCH 01/15] dt-bindings: net: wireless: mt76: document bindings " Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200130144718.14298-8-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox