drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c- Extension
.c- Size
- 9611 bytes
- Lines
- 357
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/usb.hmt76x0.hmcu.h../mt76x02_usb.h
Detected Declarations
function mt76x0_init_usb_dmafunction mt76x0u_cleanupfunction mt76x0u_stopfunction mt76x0u_startfunction mt76x0u_init_hardwarefunction mt76x0u_register_devicefunction mt76x0u_probefunction mt76x0_disconnectfunction mt76x0_suspendfunction mt76x0_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb.h>
#include "mt76x0.h"
#include "mcu.h"
#include "../mt76x02_usb.h"
static struct usb_device_id mt76x0_device_table[] = {
{ USB_DEVICE(0x148F, 0x7610) }, /* MT7610U */
{ USB_DEVICE(0x13B1, 0x003E) }, /* Linksys AE6000 */
{ USB_DEVICE(0x0E8D, 0x7610) }, /* Sabrent NTWLAC */
{ USB_DEVICE(0x7392, 0xa711) }, /* Edimax 7711mac */
{ USB_DEVICE(0x7392, 0xb711) }, /* Edimax / Elecom */
{ USB_DEVICE(0x148f, 0x761a) }, /* TP-Link TL-WDN5200 */
{ USB_DEVICE(0x148f, 0x760a) }, /* TP-Link unknown */
{ USB_DEVICE(0x0b05, 0x17d1) }, /* Asus USB-AC51 */
{ USB_DEVICE(0x0b05, 0x17db) }, /* Asus USB-AC50 */
{ USB_DEVICE(0x0df6, 0x0075) }, /* Sitecom WLA-3100 */
{ USB_DEVICE(0x2019, 0xab31) }, /* Planex GW-450D */
{ USB_DEVICE(0x2001, 0x3d02) }, /* D-LINK DWA-171 rev B1 */
{ USB_DEVICE(0x0586, 0x3425) }, /* Zyxel NWD6505 */
{ USB_DEVICE(0x07b8, 0x7610) }, /* AboCom AU7212 */
{ USB_DEVICE(0x04bb, 0x0951) }, /* I-O DATA WN-AC433UK */
{ USB_DEVICE(0x057c, 0x8502) }, /* AVM FRITZ!WLAN USB Stick AC 430 */
{ USB_DEVICE(0x293c, 0x5702) }, /* Comcast Xfinity KXW02AAA */
{ USB_DEVICE(0x20f4, 0x806b) }, /* TRENDnet TEW-806UBH */
{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac Stick */
{ USB_DEVICE(0x2357, 0x0123) }, /* TP-LINK T2UHP_US_v1 */
{ USB_DEVICE(0x2357, 0x010b) }, /* TP-LINK T2UHP_UN_v1 */
/* TP-LINK Archer T1U */
{ USB_DEVICE(0x2357, 0x0105), .driver_info = 1, },
/* MT7630U */
{ USB_DEVICE_AND_INTERFACE_INFO(0x0E8D, 0x7630, 0xff, 0x2, 0xff)},
/* MT7650U */
{ USB_DEVICE_AND_INTERFACE_INFO(0x0E8D, 0x7650, 0xff, 0x2, 0xff)},
{ 0, }
};
static void mt76x0_init_usb_dma(struct mt76x02_dev *dev)
{
u32 val;
val = mt76_rr(dev, MT_USB_DMA_CFG);
val |= MT_USB_DMA_CFG_RX_BULK_EN |
MT_USB_DMA_CFG_TX_BULK_EN;
/* disable AGGR_BULK_RX in order to receive one
* frame in each rx urb and avoid copies
*/
val &= ~MT_USB_DMA_CFG_RX_BULK_AGG_EN;
mt76_wr(dev, MT_USB_DMA_CFG, val);
val = mt76_rr(dev, MT_COM_REG0);
if (val & 1)
dev_dbg(dev->mt76.dev, "MCU not ready\n");
val = mt76_rr(dev, MT_USB_DMA_CFG);
val |= MT_USB_DMA_CFG_RX_DROP_OR_PAD;
mt76_wr(dev, MT_USB_DMA_CFG, val);
val &= ~MT_USB_DMA_CFG_RX_DROP_OR_PAD;
mt76_wr(dev, MT_USB_DMA_CFG, val);
}
static void mt76x0u_cleanup(struct mt76x02_dev *dev)
{
clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
mt76x0_chip_onoff(dev, false, false);
mt76u_queues_deinit(&dev->mt76);
}
static void mt76x0u_stop(struct ieee80211_hw *hw, bool suspend)
{
struct mt76x02_dev *dev = hw->priv;
clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
cancel_delayed_work_sync(&dev->cal_work);
cancel_delayed_work_sync(&dev->mphy.mac_work);
mt76u_stop_tx(&dev->mt76);
mt76x02u_exit_beacon_config(dev);
if (test_bit(MT76_REMOVED, &dev->mphy.state))
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/usb.h`, `mt76x0.h`, `mcu.h`, `../mt76x02_usb.h`.
- Detected declarations: `function mt76x0_init_usb_dma`, `function mt76x0u_cleanup`, `function mt76x0u_stop`, `function mt76x0u_start`, `function mt76x0u_init_hardware`, `function mt76x0u_register_device`, `function mt76x0u_probe`, `function mt76x0_disconnect`, `function mt76x0_suspend`, `function mt76x0_resume`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.