Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11993
b: refs/heads/master
c: df70b17
h: refs/heads/master
i:
  11991: 0b76bfa
v: v3
  • Loading branch information
Linus Torvalds committed Nov 1, 2005
1 parent 063d1ce commit 78d06fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94b166a7cbc232df279e1f7d5a8acfb6b8d02d59
refs/heads/master: df70b17f88a4d1d8545d3569a1f6d28c6004f9e4
23 changes: 23 additions & 0 deletions trunk/drivers/usb/host/pci-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,23 @@ int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base)
}
EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);

static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
{
u16 cmd;
return !pci_read_config_word(pdev, PCI_COMMAND, &cmd) && (cmd & mask);
}

#define pio_enabled(dev) io_type_enabled(dev, PCI_COMMAND_IO)
#define mmio_enabled(dev) io_type_enabled(dev, PCI_COMMAND_MEMORY)

static void __devinit quirk_usb_handoff_uhci(struct pci_dev *pdev)
{
unsigned long base = 0;
int i;

if (!pio_enabled(pdev))
return;

for (i = 0; i < PCI_ROM_RESOURCE; i++)
if ((pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
base = pci_resource_start(pdev, i);
Expand All @@ -153,12 +165,20 @@ static void __devinit quirk_usb_handoff_uhci(struct pci_dev *pdev)
uhci_check_and_reset_hc(pdev, base);
}

static int __devinit mmio_resource_enabled(struct pci_dev *pdev, int idx)
{
return pci_resource_start(pdev, idx) && mmio_enabled(pdev);
}

static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
{
void __iomem *base;
int wait_time;
u32 control;

if (!mmio_resource_enabled(pdev, 0))
return;

base = ioremap_nocache(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
if (base == NULL) return;
Expand Down Expand Up @@ -201,6 +221,9 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
u32 hcc_params, val, temp;
u8 cap_length;

if (!mmio_resource_enabled(pdev, 0))
return;

base = ioremap_nocache(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
if (base == NULL) return;
Expand Down

0 comments on commit 78d06fa

Please sign in to comment.