Commit 6da5a291 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76: add rd_rp and wr_rp to bus_ops/mcu_ops

Add callbacks for reading and writing reg pairs tables.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent f1638c7c
...@@ -33,12 +33,21 @@ ...@@ -33,12 +33,21 @@
struct mt76_dev; struct mt76_dev;
struct mt76_wcid; struct mt76_wcid;
struct mt76_reg_pair {
u32 reg;
u32 value;
};
struct mt76_bus_ops { struct mt76_bus_ops {
u32 (*rr)(struct mt76_dev *dev, u32 offset); u32 (*rr)(struct mt76_dev *dev, u32 offset);
void (*wr)(struct mt76_dev *dev, u32 offset, u32 val); void (*wr)(struct mt76_dev *dev, u32 offset, u32 val);
u32 (*rmw)(struct mt76_dev *dev, u32 offset, u32 mask, u32 val); u32 (*rmw)(struct mt76_dev *dev, u32 offset, u32 mask, u32 val);
void (*copy)(struct mt76_dev *dev, u32 offset, const void *data, void (*copy)(struct mt76_dev *dev, u32 offset, const void *data,
int len); int len);
int (*wr_rp)(struct mt76_dev *dev, u32 base,
const struct mt76_reg_pair *rp, int len);
int (*rd_rp)(struct mt76_dev *dev, u32 base,
struct mt76_reg_pair *rp, int len);
}; };
enum mt76_txq_id { enum mt76_txq_id {
...@@ -53,11 +62,6 @@ enum mt76_txq_id { ...@@ -53,11 +62,6 @@ enum mt76_txq_id {
__MT_TXQ_MAX __MT_TXQ_MAX
}; };
struct mt76_reg_pair {
u32 reg;
u32 value;
};
enum mt76_rxq_id { enum mt76_rxq_id {
MT_RXQ_MAIN, MT_RXQ_MAIN,
MT_RXQ_MCU, MT_RXQ_MCU,
...@@ -123,6 +127,10 @@ struct mt76_mcu_ops { ...@@ -123,6 +127,10 @@ struct mt76_mcu_ops {
struct sk_buff *(*mcu_msg_alloc)(const void *data, int len); struct sk_buff *(*mcu_msg_alloc)(const void *data, int len);
int (*mcu_send_msg)(struct mt76_dev *dev, struct sk_buff *skb, int (*mcu_send_msg)(struct mt76_dev *dev, struct sk_buff *skb,
int cmd, bool wait_resp); int cmd, bool wait_resp);
int (*mcu_wr_rp)(struct mt76_dev *dev, u32 base,
const struct mt76_reg_pair *rp, int len);
int (*mcu_rd_rp)(struct mt76_dev *dev, u32 base,
struct mt76_reg_pair *rp, int len);
}; };
struct mt76_queue_ops { struct mt76_queue_ops {
...@@ -442,6 +450,8 @@ struct mt76_rx_status { ...@@ -442,6 +450,8 @@ struct mt76_rx_status {
#define mt76_wr(dev, ...) (dev)->mt76.bus->wr(&((dev)->mt76), __VA_ARGS__) #define mt76_wr(dev, ...) (dev)->mt76.bus->wr(&((dev)->mt76), __VA_ARGS__)
#define mt76_rmw(dev, ...) (dev)->mt76.bus->rmw(&((dev)->mt76), __VA_ARGS__) #define mt76_rmw(dev, ...) (dev)->mt76.bus->rmw(&((dev)->mt76), __VA_ARGS__)
#define mt76_wr_copy(dev, ...) (dev)->mt76.bus->copy(&((dev)->mt76), __VA_ARGS__) #define mt76_wr_copy(dev, ...) (dev)->mt76.bus->copy(&((dev)->mt76), __VA_ARGS__)
#define mt76_wr_rp(dev, ...) (dev)->mt76.bus->wr_rp(&((dev)->mt76), __VA_ARGS__)
#define mt76_rd_rp(dev, ...) (dev)->mt76.bus->rd_rp(&((dev)->mt76), __VA_ARGS__)
#define mt76_mcu_msg_alloc(dev, ...) (dev)->mt76.mcu_ops->mcu_msg_alloc(__VA_ARGS__) #define mt76_mcu_msg_alloc(dev, ...) (dev)->mt76.mcu_ops->mcu_msg_alloc(__VA_ARGS__)
#define mt76_mcu_send_msg(dev, ...) (dev)->mt76.mcu_ops->mcu_send_msg(&((dev)->mt76), __VA_ARGS__) #define mt76_mcu_send_msg(dev, ...) (dev)->mt76.mcu_ops->mcu_send_msg(&((dev)->mt76), __VA_ARGS__)
......
...@@ -876,6 +876,8 @@ int mt76u_init(struct mt76_dev *dev, ...@@ -876,6 +876,8 @@ int mt76u_init(struct mt76_dev *dev,
.wr = mt76u_wr, .wr = mt76u_wr,
.rmw = mt76u_rmw, .rmw = mt76u_rmw,
.copy = mt76u_copy, .copy = mt76u_copy,
.wr_rp = mt76u_wr_rp,
.rd_rp = mt76u_rd_rp,
}; };
struct mt76_usb *usb = &dev->usb; struct mt76_usb *usb = &dev->usb;
......
...@@ -381,6 +381,8 @@ void mt76u_init_mcu_ops(struct mt76_dev *dev) ...@@ -381,6 +381,8 @@ void mt76u_init_mcu_ops(struct mt76_dev *dev)
static const struct mt76_mcu_ops mt76u_mcu_ops = { static const struct mt76_mcu_ops mt76u_mcu_ops = {
.mcu_msg_alloc = mt76u_mcu_msg_alloc, .mcu_msg_alloc = mt76u_mcu_msg_alloc,
.mcu_send_msg = mt76u_mcu_send_msg, .mcu_send_msg = mt76u_mcu_send_msg,
.mcu_wr_rp = mt76u_mcu_wr_rp,
.mcu_rd_rp = mt76u_mcu_rd_rp,
}; };
dev->mcu_ops = &mt76u_mcu_ops; dev->mcu_ops = &mt76u_mcu_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment