Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp917789ybl; Fri, 31 Jan 2020 10:19:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyJaAHCd7GakevIrfVxOeJjXpE470/bsnq+JzVS8h7//5Uc95AmFLoA2M6yRwQNLzOmvJug X-Received: by 2002:aca:aa0a:: with SMTP id t10mr7027195oie.156.1580494786692; Fri, 31 Jan 2020 10:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580494786; cv=none; d=google.com; s=arc-20160816; b=Zuo2+MV5glS6ggu08owXUEQXK1FD2ep9xxHX0xAA3che1BJslzL9Tmc7PYqW02p54V 5H9R1+uxCxsGAyvDS4vub1bu5kV9wjg+3EmpvglkJjwcZl/CBfldYq5ye4mG+CaDVWzb TjxdLQ6CfJfJ820sckWqbHNIMV9x03M+b9JEg8/18Qvf1vha6o40CnzoT3lyu84EgVYi ef4vIdKQHjrkEOyzQ9wHPy4Py0HncsUKUtvtIMS461GznoJAr8zxytnwH4EtZhOS6F3Y +WDqneNKWTy6bxzqSzWejHDz5aJVyWXdFO+GllgGtMVII6Tm8fZ2R/QPVnE2DM8OMctr WytQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=E+N0W7UmTxn8pR4Xbg6gHyLUy3Ys2fGDHcQ/zrfcsxM=; b=hjG6P4TPxOmDj6qe25u+nUnU6KarvimMrRTzxgjwHSYgtx3NlZfTD8jsKGjmQ0+xmA iIUEWuDwADwsjRrVtqSRHcDnZwjUuGo1Wyf27jrGy6fRuHPDwY0tSMV+fr5IRE77UJrU SZNZHl80z7SeBGiRmVhxMySyYZI6zOnh8XhUtYEisUsV83oKrVbmshV27MrOGCDHvhX6 hXK/QgjjOhYN9xaMWprl+b4BjreBXf+GfZxdm3PJCmvKqgO0/9RcfOvhjLf6lA4VNahd mbXjf9HK1tGp8uOs3Z/JZaqqQrcgtYBEpzA5gP+G7TSxuKf92SF6/5MFKyZ2UAvikcf9 2GxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=WUtmJR+v; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si4790208otr.8.2020.01.31.10.19.23; Fri, 31 Jan 2020 10:19:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=WUtmJR+v; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726096AbgAaSRL (ORCPT + 99 others); Fri, 31 Jan 2020 13:17:11 -0500 Received: from nbd.name ([46.4.11.11]:59404 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgAaSRK (ORCPT ); Fri, 31 Jan 2020 13:17:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=E+N0W7UmTxn8pR4Xbg6gHyLUy3Ys2fGDHcQ/zrfcsxM=; b=WUtmJR+vI+hTAF2SlD2kueDQFF 5bc+UMAzbAp9KPusw523QIvddlnZXx9iTcvsDBZq7Q+yrUA274dWNH+02gQBJYW0skBNMDarI/JQM HnUYJUWzI/VQtSPczoU+Sd1kLuC3GKcmkz7EYuNaCvlXqYnzvF4UNzJ5VU/7GRi1ap34=; Received: from [80.255.7.125] (helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ixaqr-0001G5-BY for linux-wireless@vger.kernel.org; Fri, 31 Jan 2020 19:17:09 +0100 Received: by maeck.local (Postfix, from userid 501) id 615007AFF3AB; Fri, 31 Jan 2020 19:17:08 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 2/2] mt76: mt7615: add support for testing hardware reset Date: Fri, 31 Jan 2020 19:17:08 +0100 Message-Id: <20200131181708.62698-2-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200131181708.62698-1-nbd@nbd.name> References: <20200131181708.62698-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Send an undersized corrupt packet to the DMA queue, which causes the firmware to issue a full chip reset Signed-off-by: Felix Fietkau --- .../wireless/mediatek/mt76/mt7615/debugfs.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c index 158c0c183e9c..7d8e53ac51ef 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c @@ -98,6 +98,28 @@ mt7615_fw_debug_get(void *data, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug, mt7615_fw_debug_get, mt7615_fw_debug_set, "%lld\n"); +static int +mt7615_reset_test_set(void *data, u64 val) +{ + struct mt7615_dev *dev = data; + struct sk_buff *skb; + + if (!mt7615_wait_for_mcu_init(dev)) + return 0; + + skb = alloc_skb(1, GFP_KERNEL); + if (!skb) + return -ENOMEM; + + skb_put(skb, 1); + mt76_tx_queue_skb_raw(dev, 0, skb, 0); + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_reset_test, NULL, + mt7615_reset_test_set, "%lld\n"); + static int mt7615_ampdu_stat_read(struct seq_file *file, void *data) { @@ -264,6 +286,8 @@ int mt7615_init_debugfs(struct mt7615_dev *dev) &dev->radar_pattern.power); debugfs_create_file("radar_trigger", 0200, dir, dev, &fops_radar_pattern); + debugfs_create_file("reset_test", 0200, dir, dev, + &fops_reset_test); debugfs_create_devm_seqfile(dev->mt76.dev, "temperature", dir, mt7615_read_temperature); -- 2.24.0