mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt7663u: introduce mt7663u_mcu_power_on routine
Introduce mt7663u_mcu_power_on utility routine since the code is shared between mt7663u_mcu_init() and mt7663u_probe(). Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
d3471b0d92
commit
f4c87b32e0
+5
-17
@@ -100,27 +100,15 @@ static int mt7663u_probe(struct usb_interface *usb_intf,
|
||||
(mt76_rr(dev, MT_HW_REV) & 0xff);
|
||||
dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
|
||||
|
||||
if (mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_PWR_ON,
|
||||
FW_STATE_PWR_ON << 1, 500)) {
|
||||
dev_dbg(dev->mt76.dev, "Usb device already powered on\n");
|
||||
set_bit(MT76_STATE_POWER_OFF, &dev->mphy.state);
|
||||
goto alloc_queues;
|
||||
}
|
||||
|
||||
ret = mt76u_vendor_request(&dev->mt76, MT_VEND_POWER_ON,
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR,
|
||||
0x0, 0x1, NULL, 0);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_PWR_ON,
|
||||
FW_STATE_PWR_ON << 1, 500)) {
|
||||
dev_err(dev->mt76.dev, "Timeout for power on\n");
|
||||
ret = -EIO;
|
||||
goto error;
|
||||
ret = mt7663u_mcu_power_on(dev);
|
||||
if (ret)
|
||||
goto error;
|
||||
} else {
|
||||
set_bit(MT76_STATE_POWER_OFF, &dev->mphy.state);
|
||||
}
|
||||
|
||||
alloc_queues:
|
||||
ret = mt76u_alloc_mcu_queue(&dev->mt76);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
Reference in New Issue
Block a user