public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Lorenzo Bianconi
	<lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>,
	Hans Ulli Kroll
	<ulli.kroll-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
	Jakub Kicinski <kubakici-5tc4TXWwyLM@public.gmane.org>,
	Michal Schmidt <mschmidt-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Stanislaw Gruszka
	<sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH v3 13/14] mt76x0: disable HW before probe
Date: Tue, 31 Jul 2018 14:41:03 +0200	[thread overview]
Message-ID: <1533040864-9026-14-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1533040864-9026-1-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Disable HW before probe, otherwise after reboot we will fail
to initialize MCU.

Signed-off-by: Stanislaw Gruszka <sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 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 --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;
-- 
1.9.3

  parent reply	other threads:[~2018-07-31 12:41 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 12:40 [PATCH v3 00/14] Add mt76x0 driver Stanislaw Gruszka
     [not found] ` <1533040864-9026-1-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-07-31 12:40   ` [PATCH v3 01/14] mt76x0: core files Stanislaw Gruszka
     [not found]     ` <1533040864-9026-2-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-08-02 18:52       ` Kalle Valo
2018-08-02 18:52       ` Kalle Valo
2018-07-31 12:40   ` [PATCH v3 02/14] mt76x0: mac files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 03/14] mt76x0: usb files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 04/14] mt76x0: mcu files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 05/14] mt76x0: phy files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 06/14] mt76x0: init files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 07/14] mt76x0: eeprom files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 08/14] mt76x0: trace and debugfs files Stanislaw Gruszka
2018-07-31 12:40   ` [PATCH v3 09/14] mt76x0: dma and tx files Stanislaw Gruszka
2018-07-31 12:41   ` [PATCH v3 10/14] mt76x0: main file Stanislaw Gruszka
2018-07-31 12:41   ` [PATCH v3 11/14] mt76: add more states Stanislaw Gruszka
2018-07-31 12:41   ` [PATCH v3 12/14] mt76: Kconfig and Makefile for mt76x0 driver Stanislaw Gruszka
     [not found]     ` <1533040864-9026-13-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-08-01  7:32       ` Kalle Valo
     [not found]         ` <8736vy1r0j.fsf-5ukZ45wKbUHoml4zekdYB16hYfS7NtTn@public.gmane.org>
2018-08-01  8:28           ` Stanislaw Gruszka
     [not found]             ` <20180801082844.GB4526-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-08-01  8:41               ` Kalle Valo
     [not found]                 ` <87600u8on6.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>
2018-08-01  8:59                   ` Stanislaw Gruszka
     [not found]                     ` <20180801085913.GC4526-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-08-02 17:11                       ` Kalle Valo
2018-07-31 12:41   ` Stanislaw Gruszka [this message]
2018-07-31 12:41   ` [PATCH v3 14/14] mt76x0: load firmware from mediatek subdir Stanislaw Gruszka
2018-08-01  7:39   ` [PATCH v3 00/14] Add mt76x0 driver Kalle Valo
     [not found]     ` <87y3dqzga9.fsf-5ukZ45wKbUHoml4zekdYB16hYfS7NtTn@public.gmane.org>
2018-08-01  8:13       ` Lorenzo Bianconi
     [not found]         ` <20180801081346.GA4794-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2018-08-01  8:19           ` Kalle Valo
2018-08-01  8:25       ` Stanislaw Gruszka
     [not found]         ` <20180801082508.GA4526-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-08-01  8:40           ` Lorenzo Bianconi
     [not found]             ` <20180801084056.GB4794-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2018-08-02 17:20               ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533040864-9026-14-git-send-email-sgruszka@redhat.com \
    --to=sgruszka-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=kubakici-5tc4TXWwyLM@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=mschmidt-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=nbd-Vt+b4OUoWG0@public.gmane.org \
    --cc=ulli.kroll-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox