-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mt76x0: inital split between pci and usb
For now pci driver can read ASIC version from the device :-) Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
- Loading branch information
Stanislaw Gruszka
authored and
Felix Fietkau
committed
Sep 19, 2018
1 parent
1bee323
commit c2a4d9f
Showing
9 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
obj-$(CONFIG_MT76x0U) += mt76x0.o | ||
obj-$(CONFIG_MT76x0U) += mt76x0u.o | ||
obj-$(CONFIG_MT76x0E) += mt76x0e.o | ||
obj-$(CONFIG_MT76x0_COMMON) += mt76x0-common.o | ||
|
||
mt76x0-objs = \ | ||
usb.o init.o main.o mcu.o trace.o eeprom.o phy.o \ | ||
mt76x0-common-y := \ | ||
init.o main.o mcu.o trace.o eeprom.o phy.o \ | ||
mac.o debugfs.o tx.o | ||
mt76x0u-y := usb.o | ||
mt76x0e-y := pci.o | ||
|
||
# ccflags-y := -DDEBUG | ||
CFLAGS_trace.o := -I$(src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,3 +445,5 @@ mt76x0_eeprom_init(struct mt76x0_dev *dev) | |
kfree(eeprom); | ||
return ret; | ||
} | ||
|
||
MODULE_LICENSE("Dual BSD/GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (C) 2016 Felix Fietkau <nbd@nbd.name> | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/module.h> | ||
#include <linux/pci.h> | ||
|
||
#include "mt76x0.h" | ||
|
||
static int | ||
mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
{ | ||
struct mt76x0_dev *dev; | ||
int ret = -ENODEV; | ||
|
||
ret = pcim_enable_device(pdev); | ||
if (ret) | ||
return ret; | ||
|
||
ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); | ||
if (ret) | ||
return ret; | ||
|
||
pci_set_master(pdev); | ||
|
||
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
if (ret) | ||
return ret; | ||
|
||
dev = mt76x0_alloc_device(&pdev->dev); | ||
if (!dev) | ||
return -ENOMEM; | ||
|
||
mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); | ||
|
||
dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); | ||
dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); | ||
|
||
/* error: */ | ||
ieee80211_free_hw(mt76_hw(dev)); | ||
return ret; | ||
} | ||
|
||
static void | ||
mt76x0e_remove(struct pci_dev *pdev) | ||
{ | ||
struct mt76_dev *mdev = pci_get_drvdata(pdev); | ||
|
||
mt76_unregister_device(mdev); | ||
ieee80211_free_hw(mdev->hw); | ||
} | ||
|
||
static const struct pci_device_id mt76x0e_device_table[] = { | ||
{ PCI_DEVICE(0x14c3, 0x7630) }, | ||
{ }, | ||
}; | ||
|
||
MODULE_DEVICE_TABLE(pci, mt76x0e_device_table); | ||
MODULE_LICENSE("Dual BSD/GPL"); | ||
|
||
static struct pci_driver mt76x0e_driver = { | ||
.name = KBUILD_MODNAME, | ||
.id_table = mt76x0e_device_table, | ||
.probe = mt76x0e_probe, | ||
.remove = mt76x0e_remove, | ||
}; | ||
|
||
module_pci_driver(mt76x0e_driver); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters