mt76: mt7615: introduce mt7615_mcu_fill_msg
Introduce mt7615_mcu_fill_msg routine to initialize mcu messages. mt7615_mcu_fill_msg will be reused adding mt7663u support Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
373954ef27
commit
63f09b6b98
|
@ -49,22 +49,20 @@ struct mt7615_fw_trailer {
|
||||||
#define FW_START_OVERRIDE BIT(0)
|
#define FW_START_OVERRIDE BIT(0)
|
||||||
#define FW_START_WORKING_PDA_CR4 BIT(2)
|
#define FW_START_WORKING_PDA_CR4 BIT(2)
|
||||||
|
|
||||||
static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb,
|
void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
|
||||||
int cmd, int *wait_seq)
|
int cmd, int *wait_seq)
|
||||||
{
|
{
|
||||||
struct mt7615_mcu_txd *mcu_txd;
|
struct mt7615_mcu_txd *mcu_txd;
|
||||||
u8 seq, q_idx, pkt_fmt;
|
u8 seq, q_idx, pkt_fmt;
|
||||||
enum mt76_txq_id qid;
|
|
||||||
u32 val;
|
|
||||||
__le32 *txd;
|
__le32 *txd;
|
||||||
|
u32 val;
|
||||||
|
|
||||||
seq = ++dev->mt76.mcu.msg_seq & 0xf;
|
seq = ++dev->mt76.mcu.msg_seq & 0xf;
|
||||||
if (!seq)
|
if (!seq)
|
||||||
seq = ++dev->mt76.mcu.msg_seq & 0xf;
|
seq = ++dev->mt76.mcu.msg_seq & 0xf;
|
||||||
|
|
||||||
mcu_txd = (struct mt7615_mcu_txd *)skb_push(skb,
|
mcu_txd = (struct mt7615_mcu_txd *)skb_push(skb, sizeof(*mcu_txd));
|
||||||
sizeof(struct mt7615_mcu_txd));
|
memset(mcu_txd, 0, sizeof(*mcu_txd));
|
||||||
memset(mcu_txd, 0, sizeof(struct mt7615_mcu_txd));
|
|
||||||
|
|
||||||
if (cmd != -MCU_CMD_FW_SCATTER) {
|
if (cmd != -MCU_CMD_FW_SCATTER) {
|
||||||
q_idx = MT_TX_MCU_PORT_RX_Q0;
|
q_idx = MT_TX_MCU_PORT_RX_Q0;
|
||||||
|
@ -73,7 +71,6 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb,
|
||||||
q_idx = MT_TX_MCU_PORT_RX_FWDL;
|
q_idx = MT_TX_MCU_PORT_RX_FWDL;
|
||||||
pkt_fmt = MT_TX_TYPE_FW;
|
pkt_fmt = MT_TX_TYPE_FW;
|
||||||
}
|
}
|
||||||
|
|
||||||
txd = mcu_txd->txd;
|
txd = mcu_txd->txd;
|
||||||
|
|
||||||
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len) |
|
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len) |
|
||||||
|
@ -104,7 +101,14 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb,
|
||||||
|
|
||||||
if (wait_seq)
|
if (wait_seq)
|
||||||
*wait_seq = seq;
|
*wait_seq = seq;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb,
|
||||||
|
int cmd, int *wait_seq)
|
||||||
|
{
|
||||||
|
enum mt76_txq_id qid;
|
||||||
|
|
||||||
|
mt7615_mcu_fill_msg(dev, skb, cmd, wait_seq);
|
||||||
if (test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
|
if (test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
|
||||||
qid = MT_TXQ_MCU;
|
qid = MT_TXQ_MCU;
|
||||||
else
|
else
|
||||||
|
|
|
@ -364,6 +364,8 @@ int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val);
|
||||||
int mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int band, int enter);
|
int mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int band, int enter);
|
||||||
int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index);
|
int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index);
|
||||||
void mt7615_mcu_exit(struct mt7615_dev *dev);
|
void mt7615_mcu_exit(struct mt7615_dev *dev);
|
||||||
|
void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
|
||||||
|
int cmd, int *wait_seq);
|
||||||
|
|
||||||
int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
|
int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
|
||||||
enum mt76_txq_id qid, struct mt76_wcid *wcid,
|
enum mt76_txq_id qid, struct mt76_wcid *wcid,
|
||||||
|
|
Loading…
Reference in New Issue