From nobody Wed Oct 04 01:44:16 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S0ctS3B0kz4wMw8; Wed, 4 Oct 2023 01:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S0ctS2MTTz4cqW; Wed, 4 Oct 2023 01:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696383856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8AevzWiONsOLrj+rkJtTnkOUWNw5rJ2WTAJh/ZW3FxU=; b=EdXWXuCcb3H+9GHfI3ufBDv7QGL+QToVeDzbnG7Jyhe6b98OgmvrE0qCLJFZDUUytP66TV SFebOEOv6cHHbTyBsmrrwHfiNYSdzRhiEWiNE9tzEWZicMR6agNownHStKEuDngX5T1i6g K50sHFaEphA+Og71rm0bdPxJk8LLGTgvqbYRVAq9tmekT67Gbd2iPJxelkoq7DaW6KFL+h V37uqYXnnWmD2NqG3Ow7zahCL/HJcEJttEpm6gC9HZ8vosX33y1VaNziaP22K/nU3Ny7FK x4FwBjYmprOs0vs8InscXhabq5WKWZUIE9+mODHgsaEPg+lwdFofcG7YEhUwbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696383856; a=rsa-sha256; cv=none; b=ZpuyNIZ+MD0hX+ShrFmwCxmHdZXKpgCLML8XBlXjtLxA+gNqRiBcEpGaLbzAhOD4wk3IgH tBwtC9dm8QoqF96MachHMhSoeIk3kKx8LJDX1mIOXvM+KzIXArk+b7xQUceYXfeeO7gwd9 ZtALbUChUJhzTt7uNo76onJ+5jt7Kbo4xqVormuSv+7iCQ6m7gH+fBb8dJZasWwEo1jTyx 4/r6juWqqL1+IP8ad364GBqwROqT/2XwAP/pd8Gc39z4Pixw925Viw6QSUctLTwHtXUZdt XqtNLfV4z0nZ4vUhO1nD54vnhVe5aFkPfXwg2FJ/PuOm31F/kg0O4G7N9kjrvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696383856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8AevzWiONsOLrj+rkJtTnkOUWNw5rJ2WTAJh/ZW3FxU=; b=ON9Zo8f2PT/bo+MUkmgOf7F+TL2hefgZrIPOwW2CC+mzSN4JbFQA8P8QEl/C55KOeZkhe/ B/JPCbN+epKuuPEsBDKAQl6xfYbGWkYpfWEaqpgbOFJ4UcU7hj1dsfkFcFNCNNhb7s8xQC E+sXdPlyaoGdYM5a8gym2QD29F7rF9A2Lbxv/xfMZTTKpEASX4o0InAyyBQY+8AoFY8MGS d1aoYe2UwOeUhZdJC/AIKkniPgO/iDUZX8MdKd3ZGdzC745cGrVe6F9qnaOl+z0p00jMKA Mfy/UTq4UTJbQd12uQJORth6UTlJV4KHr/0cZY08TeetFdQZkfLFltTtJnKFfg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S0ctS1R1Pz40s; Wed, 4 Oct 2023 01:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3941iGSo020570; Wed, 4 Oct 2023 01:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3941iGcU020567; Wed, 4 Oct 2023 01:44:16 GMT (envelope-from git) Date: Wed, 4 Oct 2023 01:44:16 GMT Message-Id: <202310040144.3941iGcU020567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 05a0e28167d5 - stable/13 - xhci: Add support for 64-bit DMA in generic XHCI controller driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 05a0e28167d5ab68762ad0a56d6dc9af4ed48d55 Auto-Submitted: auto-generated The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=05a0e28167d5ab68762ad0a56d6dc9af4ed48d55 commit 05a0e28167d5ab68762ad0a56d6dc9af4ed48d55 Author: Stephen J. Kiernan AuthorDate: 2023-08-11 16:06:02 +0000 Commit: Kyle Evans CommitDate: 2023-10-04 01:42:34 +0000 xhci: Add support for 64-bit DMA in generic XHCI controller driver The XHCI controller on 64-bit SoCs need to use 64-bit DMA. Add a quirk to tell the generic XHCI driver that 32-bit DMA needs to be used, if there are any that may need to use 32-bit DMA only. PR: 274237 Reviewed by: andrew Obtained from: Juniper Networks, Inc. (cherry picked from commit 332af8c25dfc9857e997817281d7b7fa406783ef) --- sys/dev/usb/controller/generic_xhci.c | 9 ++++++++- sys/dev/usb/controller/generic_xhci_fdt.c | 20 +++++++++++++++----- sys/dev/usb/controller/xhci.h | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/controller/generic_xhci.c b/sys/dev/usb/controller/generic_xhci.c index e0caf8f42af5..e89d1bc84497 100644 --- a/sys/dev/usb/controller/generic_xhci.c +++ b/sys/dev/usb/controller/generic_xhci.c @@ -61,7 +61,13 @@ #include "generic_xhci.h" +#if __SIZEOF_LONG__ == 8 +#define IS_DMA_32B 0 +#elif __SIZEOF_LONG__ == 4 #define IS_DMA_32B 1 +#else +#error unsupported long size +#endif int generic_xhci_attach(device_t dev) @@ -114,7 +120,8 @@ generic_xhci_attach(device_t dev) return (err); } - err = xhci_init(sc, dev, IS_DMA_32B); + err = xhci_init(sc, dev, + (sc->sc_quirks & XHCI_QUIRK_DMA_32B) == 0 ? IS_DMA_32B : 1); if (err != 0) { device_printf(dev, "Failed to init XHCI, with error %d\n", err); generic_xhci_detach(dev); diff --git a/sys/dev/usb/controller/generic_xhci_fdt.c b/sys/dev/usb/controller/generic_xhci_fdt.c index 8af9591a86b4..c850d2fb1314 100644 --- a/sys/dev/usb/controller/generic_xhci_fdt.c +++ b/sys/dev/usb/controller/generic_xhci_fdt.c @@ -55,12 +55,16 @@ #include "generic_xhci.h" +/* Flags for the OFW compat data table */ +#define XHCI_FDT_MATCH 0x01 +#define XHCI_FDT_32BIT_DMA 0x02 /* Controller needs 32-bit DMA */ + static struct ofw_compat_data compat_data[] = { - {"marvell,armada-380-xhci", true}, - {"marvell,armada3700-xhci", true}, - {"marvell,armada-8k-xhci", true}, - {"generic-xhci", true}, - {NULL, false} + {"marvell,armada-380-xhci", XHCI_FDT_MATCH}, + {"marvell,armada3700-xhci", XHCI_FDT_MATCH}, + {"marvell,armada-8k-xhci", XHCI_FDT_MATCH}, + {"generic-xhci", XHCI_FDT_MATCH}, + {NULL, 0} }; static int @@ -81,14 +85,20 @@ generic_xhci_fdt_probe(device_t dev) static int generic_xhci_fdt_attach(device_t dev) { + struct xhci_softc *sc = device_get_softc(dev); phandle_t node; phy_t phy; + int flags; node = ofw_bus_get_node(dev); if (phy_get_by_ofw_property(dev, node, "usb-phy", &phy) == 0) if (phy_enable(phy) != 0) device_printf(dev, "Cannot enable phy\n"); + flags = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if ((flags & XHCI_FDT_32BIT_DMA) != 0) + sc->sc_quirks |= XHCI_QUIRK_DMA_32B; + return (generic_xhci_attach(dev)); } diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index 0be0d185a869..3758815238ad 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -488,6 +488,7 @@ typedef int (xhci_port_route_t)(device_t, uint32_t, uint32_t); enum xhci_quirks { XHCI_QUIRK_DISABLE_PORT_PED = 0x00000001, + XHCI_QUIRK_DMA_32B = 0x00000002, }; struct xhci_softc {