From: Mingcong Bai <jeffbaichina@gmail.com>
To: "Huacai Chen" <chenhuacai@loongson.cn>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>
Cc: linux-pci@vger.kernel.org, Jianmin Lv <lvjianmin@loongson.cn>,
Xuefeng Li <lixuefeng@loongson.cn>,
Huacai Chen <chenhuacai@gmail.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Kexy Biscuit <kexybiscuit@aosc.io>
Subject: Re: [PATCH] PCI: loongson: Add quirk for OHCI device rev 0x02
Date: Wed, 22 Jan 2025 23:12:01 +0800 [thread overview]
Message-ID: <78577c99-22b4-4598-8714-2a3884cc86c6@gmail.com> (raw)
In-Reply-To: <20250121114225.2727684-1-chenhuacai@loongson.cn>
Hi Huacai,
在 2025/1/21 19:42, Huacai Chen 写道:
> 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 BAR resource as
> a workaround.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> drivers/pci/controller/pci-loongson.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controller/pci-loongson.c
> index bc630ab8a283..977f7b15f3a7 100644
> --- a/drivers/pci/controller/pci-loongson.c
> +++ b/drivers/pci/controller/pci-loongson.c
> @@ -32,6 +32,7 @@
> #define DEV_LS7A_CONF 0x7a10
> #define DEV_LS7A_GNET 0x7a13
> #define DEV_LS7A_EHCI 0x7a14
> +#define DEV_LS7A_OHCI 0x7a24
> #define DEV_LS7A_DC2 0x7a36
> #define DEV_LS7A_HDMI 0x7a37
>
> @@ -144,6 +145,13 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
> DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
> DEV_LS7A_PCIE_PORT6, loongson_mrrs_quirk);
>
> +static void loongson_ohci_quirk(struct pci_dev *dev)
> +{
> + if (dev->revision == 0x2)
> + dev->resource[0].start += 0x1000;
> +}
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, DEV_LS7A_OHCI, loongson_ohci_quirk);
> +
> static void loongson_pci_pin_quirk(struct pci_dev *pdev)
> {
> pdev->pin = 1 + (PCI_FUNC(pdev->devfn) & 3);
I have tested this patch and can confirm that it fixes USB full-speed
and low-speed devices (such as keyboards and mice) on ASUS XC-LS3A6M
boards. The full-/low-speed devices only work consistently with this
specific patch applied, or at least one of the two full-/low-speed
devices would not work.
P.S., With more than one SuperSpeed devices plugged in, the issue
reproduced more reliably, where at least one of the two full-/low-speed
devices would not work. With three SuperSpeed devices plugged in,
filling all five downstream facing ports at the back of the board along
with the two full-/low-speed devices, the issue reproduced consistently.
Similar issues have also been reported by mini PC (NUC) users, but I do
not own such a device.
Tested-by: Mingcong Bai <jeffbai@aosc.io>
Best Regards,
Mingcong Bai
next prev parent reply other threads:[~2025-01-22 15:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 11:42 [PATCH] PCI: loongson: Add quirk for OHCI device rev 0x02 Huacai Chen
2025-01-22 15:12 ` Mingcong Bai [this message]
2025-03-14 7:53 ` Krzysztof Wilczyński
2025-03-15 3:45 ` Huacai Chen
2025-03-15 4:00 ` Krzysztof Wilczyński
2025-03-14 19:59 ` Bjorn Helgaas
2025-03-18 13:07 ` Huacai Chen
2025-03-18 21:50 ` Bjorn Helgaas
2025-03-26 9:15 ` Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=78577c99-22b4-4598-8714-2a3884cc86c6@gmail.com \
--to=jeffbaichina@gmail.com \
--cc=bhelgaas@google.com \
--cc=chenhuacai@gmail.com \
--cc=chenhuacai@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=kexybiscuit@aosc.io \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=lorenzo.pieralisi@arm.com \
--cc=lvjianmin@loongson.cn \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox