Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: USB troubles with SB600/SB700 chipsets



On Fri, Jun 12, 2009 at 12:27:49AM +0200, Bernd Ernesti wrote:
> +     /* Handle quirks */
> +     switch (quirk) {
> +     case EHCI_PCI_QUIRK_AMD_SB600:
> +             ehci_apply_amd_quirks(sc);
> +     case EHCI_PCI_QUIRK_AMD_SB700:
> +             if (pci_find_device(NULL, ehci_sb700_match))
> +                     ehci_apply_amd_quirks(sc);
> +     }
> +

You may need a break in there somewhere.

> +static int
> +ehci_apply_amd_quirks(struct ehci_pci_softc *sc)
> +{
> +     uint32_t value;
> + 
> +     aprint_normal_dev(sc->sc.sc_dev,
> +         "applying AMD SB600/SB700 USB freeze workaround\n");
> +     value = pci_conf_read(sc->sc_pc, sc->sc_tag, 0x50);
> +     value |= (1U << 27);
> +     pci_conf_write(sc->sc_pc, sc->sc_tag, 0x50, value);

Even magic numbers can be named. :-)

#define EHCI_SBx00_WORKAROUND_REG       0x50
#define EHCI_SBx00_WORKAROUND_ENABLE    __BIT(27)

> +enum ehci_pci_quirk_flags
> +ehci_pci_lookup_quirkdata(pci_vendor_id_t vendor, pci_product_id_t product)
> +{
> +     int i;
> +
> +     for (i = 0; i < (sizeof ehci_pci_quirks / sizeof ehci_pci_quirks[0]);
> +         i++)

I suggest __arraycount(ehci_pci_quirks).

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index