mt76: usb: add req_type to ___mt76u_rr signature

This is a preliminary patch to add usb support to mt7921 driver.

Tested-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:
Lorenzo Bianconi 2022-03-14 16:10:23 +01:00 committed by Felix Fietkau
parent 51f9325c7b
commit 84bba93ac4

View File

@ -62,16 +62,15 @@ int mt76u_vendor_request(struct mt76_dev *dev, u8 req,
} }
EXPORT_SYMBOL_GPL(mt76u_vendor_request); EXPORT_SYMBOL_GPL(mt76u_vendor_request);
static u32 ___mt76u_rr(struct mt76_dev *dev, u8 req, u32 addr) static u32 ___mt76u_rr(struct mt76_dev *dev, u8 req, u8 req_type,
u32 addr)
{ {
struct mt76_usb *usb = &dev->usb; struct mt76_usb *usb = &dev->usb;
u32 data = ~0; u32 data = ~0;
int ret; int ret;
ret = __mt76u_vendor_request(dev, req, ret = __mt76u_vendor_request(dev, req, req_type, addr >> 16,
USB_DIR_IN | USB_TYPE_VENDOR, addr, usb->data, sizeof(__le32));
addr >> 16, addr, usb->data,
sizeof(__le32));
if (ret == sizeof(__le32)) if (ret == sizeof(__le32))
data = get_unaligned_le32(usb->data); data = get_unaligned_le32(usb->data);
trace_usb_reg_rr(dev, addr, data); trace_usb_reg_rr(dev, addr, data);
@ -95,7 +94,8 @@ static u32 __mt76u_rr(struct mt76_dev *dev, u32 addr)
break; break;
} }
return ___mt76u_rr(dev, req, addr & ~MT_VEND_TYPE_MASK); return ___mt76u_rr(dev, req, USB_DIR_IN | USB_TYPE_VENDOR,
addr & ~MT_VEND_TYPE_MASK);
} }
static u32 mt76u_rr(struct mt76_dev *dev, u32 addr) static u32 mt76u_rr(struct mt76_dev *dev, u32 addr)
@ -114,7 +114,8 @@ static u32 mt76u_rr_ext(struct mt76_dev *dev, u32 addr)
u32 ret; u32 ret;
mutex_lock(&dev->usb.usb_ctrl_mtx); mutex_lock(&dev->usb.usb_ctrl_mtx);
ret = ___mt76u_rr(dev, MT_VEND_READ_EXT, addr); ret = ___mt76u_rr(dev, MT_VEND_READ_EXT,
USB_DIR_IN | USB_TYPE_VENDOR, addr);
mutex_unlock(&dev->usb.usb_ctrl_mtx); mutex_unlock(&dev->usb.usb_ctrl_mtx);
return ret; return ret;
@ -177,7 +178,8 @@ static u32 mt76u_rmw_ext(struct mt76_dev *dev, u32 addr,
u32 mask, u32 val) u32 mask, u32 val)
{ {
mutex_lock(&dev->usb.usb_ctrl_mtx); mutex_lock(&dev->usb.usb_ctrl_mtx);
val |= ___mt76u_rr(dev, MT_VEND_READ_EXT, addr) & ~mask; val |= ___mt76u_rr(dev, MT_VEND_READ_EXT,
USB_DIR_IN | USB_TYPE_VENDOR, addr) & ~mask;
___mt76u_wr(dev, MT_VEND_WRITE_EXT, addr, val); ___mt76u_wr(dev, MT_VEND_WRITE_EXT, addr, val);
mutex_unlock(&dev->usb.usb_ctrl_mtx); mutex_unlock(&dev->usb.usb_ctrl_mtx);