Skip to content

Commit bcb60d4

Browse files
chenhuacaigregkh
authored andcommitted
USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02)
The OHCI controller (rev 0x02) under LS7A PCI host has a hardware flaw. MMIO register with offset 0x60/0x64 is treated as legacy PS2-compatible keyboard/mouse interface, which confuse the OHCI controller. Since OHCI only use a 4KB BAR resource indeed, the LS7A OHCI controller's 32KB BAR is wrapped around (the second 4KB BAR space is the same as the first 4KB internally). So we can add an 4KB offset (0x1000) to the OHCI registers (from the PCI BAR resource) as a quirk. Cc: stable <stable@kernel.org> Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Mingcong Bai <baimingcong@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://lore.kernel.org/r/20250328040059.3672979-1-chenhuacai@loongson.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 38d6e60 commit bcb60d4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/usb/host/ohci-pci.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,25 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
165165
return 0;
166166
}
167167

168+
static int ohci_quirk_loongson(struct usb_hcd *hcd)
169+
{
170+
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
171+
172+
/*
173+
* Loongson's LS7A OHCI controller (rev 0x02) has a
174+
* flaw. MMIO register with offset 0x60/64 is treated
175+
* as legacy PS2-compatible keyboard/mouse interface.
176+
* Since OHCI only use 4KB BAR resource, LS7A OHCI's
177+
* 32KB BAR is wrapped around (the 2nd 4KB BAR space
178+
* is the same as the 1st 4KB internally). So add 4KB
179+
* offset (0x1000) to the OHCI registers as a quirk.
180+
*/
181+
if (pdev->revision == 0x2)
182+
hcd->regs += SZ_4K; /* SZ_4K = 0x1000 */
183+
184+
return 0;
185+
}
186+
168187
static int ohci_quirk_qemu(struct usb_hcd *hcd)
169188
{
170189
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
@@ -224,6 +243,10 @@ static const struct pci_device_id ohci_pci_quirks[] = {
224243
PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
225244
.driver_data = (unsigned long)ohci_quirk_amd700,
226245
},
246+
{
247+
PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, 0x7a24),
248+
.driver_data = (unsigned long)ohci_quirk_loongson,
249+
},
227250
{
228251
.vendor = PCI_VENDOR_ID_APPLE,
229252
.device = 0x003f,

0 commit comments

Comments
 (0)