diff mbox series

[v3,13/14] mt76x0: disable HW before probe

Message ID 1533040864-9026-14-git-send-email-sgruszka@redhat.com (mailing list archive)
State Accepted
Commit 369bbecdbb2def6265c06512c44e1fbe6ad8e556
Delegated to: Kalle Valo
Headers show
Series Add mt76x0 driver | expand

Commit Message

Stanislaw Gruszka July 31, 2018, 12:41 p.m. UTC
Disable HW before probe, otherwise after reboot we will fail
to initialize MCU.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/init.c   | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 1 +
 drivers/net/wireless/mediatek/mt76/mt76x0/usb.c    | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
index b65b76d80906..7cdb3e740522 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
@@ -62,7 +62,7 @@ 
 		dev_err(dev->mt76.dev, "Error: PLL and XTAL check failed!\n");
 }
 
-static void mt76x0_chip_onoff(struct mt76x0_dev *dev, bool enable, bool reset)
+void mt76x0_chip_onoff(struct mt76x0_dev *dev, bool enable, bool reset)
 {
 	u32 val;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index 49b82a23533c..9e60fcb14687 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -288,6 +288,7 @@  int mt76x0_burst_write_regs(struct mt76x0_dev *dev, u32 offset,
 int mt76x0_init_hardware(struct mt76x0_dev *dev);
 int mt76x0_register_device(struct mt76x0_dev *dev);
 void mt76x0_cleanup(struct mt76x0_dev *dev);
+void mt76x0_chip_onoff(struct mt76x0_dev *dev, bool enable, bool reset);
 
 int mt76x0_mac_start(struct mt76x0_dev *dev);
 void mt76x0_mac_stop(struct mt76x0_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 0871fdef59c3..7a635cdcbae0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -283,6 +283,10 @@  static int mt76x0_probe(struct usb_interface *usb_intf,
 	ret = mt76x0_assign_pipes(usb_intf, dev);
 	if (ret)
 		goto err;
+
+	/* Disable the HW, otherwise MCU fail to initalize on hot reboot */
+	mt76x0_chip_onoff(dev, false, false);
+
 	ret = mt76x0_wait_asic_ready(dev);
 	if (ret)
 		goto err;