9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/pci.h>
13 #include <linux/slab.h>
29 u64 capdata_orig = capdata;
32 && (pci_dev->
device == 0x0c3b || pci_dev->
device == 0004)
33 && pci_dev->
class == 0x0d1010) {
37 capdata |= 0x40 << 8;
break;
46 if (capdata_orig != capdata)
48 "PCI v%04x d%04x c%06x#%02x: "
49 "corrected capdata from %016Lx to %016Lx\n",
52 (
unsigned long long)capdata_orig,
53 (
unsigned long long)capdata);
64 unsigned long max_ms,
const char *
tag)
70 if ((val & mask) == result)
73 dev_err(dev,
"%s timed out\n", tag);
92 static int whci_add_cap(
struct whci_card *card,
int n)
106 capdata = whci_capdata_quirks(card, capdata);
119 umc->
irq = card->
pci->irq;
132 static void whci_del_cap(
struct whci_card *card,
int n)
140 static int whci_n_caps(
struct pci_dev *pci)
145 uwbbase = pci_iomap(pci, 0, 8);
154 static int whci_probe(
struct pci_dev *pci,
const struct pci_device_id *
id)
172 err = n_caps = whci_n_caps(pci);
178 +
sizeof(
struct whci_dev *) * (n_caps + 1),
188 "whci (capability data)"))
189 goto error_request_memregion;
196 for (n = 0; n <= card->
n_caps; n++) {
197 err = whci_add_cap(card, n);
198 if (err < 0 && n == 0) {
199 dev_err(&pci->
dev,
"cannot bind UWB radio controller:"
204 dev_warn(&pci->
dev,
"warning: cannot bind capability "
205 "#%u: %d\n", n, err);
207 pci_set_drvdata(pci, card);
214 error_request_memregion:
225 static void whci_remove(
struct pci_dev *pci)
227 struct whci_card *card = pci_get_drvdata(pci);
230 pci_set_drvdata(pci,
NULL);
233 for (n = card->
n_caps; n >= 0 ; n--)
234 whci_del_cap(card, n);
251 .id_table = whci_id_table,
253 .remove = whci_remove,
256 static int __init whci_init(
void)
258 return pci_register_driver(&whci_driver);
261 static void __exit whci_exit(
void)