From nobody Sat Sep 13 18:29:31 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 463BCC38142 for ; Tue, 31 Jan 2023 15:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233043AbjAaPPz (ORCPT ); Tue, 31 Jan 2023 10:15:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232882AbjAaPPV (ORCPT ); Tue, 31 Jan 2023 10:15:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801CC5895F; Tue, 31 Jan 2023 07:13:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 599BDB81D3A; Tue, 31 Jan 2023 15:05:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26944C433EF; Tue, 31 Jan 2023 15:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675177555; bh=NR6+Sw+XVUUAfLO1fjlZDIfAaaMpw56BqG+CDyOuZc0=; h=From:To:Cc:Subject:Date:From; b=FAxB/d/VFKe8weXPQxHIJdwbvxx+IB75ht8FO6HDi28XPgYzhpTk5E2kZgzqJl3WH 7iD07f3HHFN/0Bqt2emFiOiNA7eXLMH3+z3G4BYg4qNJ9ZxtwK8asiImw46XvcgrwI f+QUPEIL893vbeXAhicWwP+w+Fmv6s1g5GqNJDf+VrAq5pzD8leTMhLgq6sADh99Tr h41vFhznOBckeMgtts5lp4BmDAu5Kq3HuA+qgLq5ec7RPeKsN7H7kVg/Oek7VF1CVl s0pUHXqE3ttz41MwX+2rRvLITwV+tTTPZcoLbqdeKn0BB6dPo3QrNnQZ0GnA1PHh8J CjH+wmggS03cA== From: Arnd Bergmann To: Greg Kroah-Hartman , Mathias Nyman , Biju Das Cc: Arnd Bergmann , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Geert Uytterhoeven , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH] xhci: split out rcar/rz support from xhci-plat.c Date: Tue, 31 Jan 2023 16:04:31 +0100 Message-Id: <20230131150531.12347-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The USB_XHCI_RZV2M and USB_RENESAS_USB3 select other drivers based on the enabled SoC types, which leads to build failures when the dependencies are not met: WARNING: unmet direct dependencies detected for USB_RZV2M_USB3DRD Depends on [n]: USB_SUPPORT [=3Dy] && USB_GADGET [=3Dn] && (ARCH_R9A09G01= 1 [=3Dn] || COMPILE_TEST [=3Dy]) Selected by [m]: - USB_XHCI_RZV2M [=3Dm] && USB_SUPPORT [=3Dy] && USB [=3Dy] && USB_XHCI_H= CD [=3Dm] && USB_XHCI_PLATFORM [=3Dm] && (ARCH_R9A09G011 [=3Dn] || COMPILE_= TEST [=3Dy]) ERROR: modpost: "rzv2m_usb3drd_reset" [drivers/usb/host/xhci-plat-hcd.ko] u= ndefined! The xhci-rcar driver has a reverse dependency with the xhci core, and it depends on the UDC driver in turn. To untangle this, make the xhci-rcar.ko driver a standalone module that just calls into the xhci-plat.ko module like other drivers do. This allows handling the dependency on the USB_RZV2M_USB3DRD driver to only affect the xhci-rcar module and simplify the xhci-plat module. It also allows leaving out the hacks for broken dma mask and nested devices from the rcar side and keep that only in the generic xhci driver. As a future cleanup, the marvell and dwc3 specific bits of xhci-plat.c could be moved out as well, but that is not required for this bugfix. Fixes: c52c9acc415e ("xhci: host: Add Renesas RZ/V2M SoC support") Signed-off-by: Arnd Bergmann Tested-by: Biju Das --- drivers/usb/gadget/udc/Kconfig | 4 +- drivers/usb/host/Kconfig | 9 ++- drivers/usb/host/Makefile | 11 ++- drivers/usb/host/xhci-plat.c | 127 +++++++++++++-------------------- drivers/usb/host/xhci-plat.h | 7 ++ drivers/usb/host/xhci-rcar.c | 102 ++++++++++++++++++++++++-- drivers/usb/host/xhci-rcar.h | 55 -------------- 7 files changed, 164 insertions(+), 151 deletions(-) delete mode 100644 drivers/usb/host/xhci-rcar.h diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 9b7a1681550f..20b477b2a080 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig @@ -182,8 +182,6 @@ config USB_RENESAS_USBHS_UDC config USB_RZV2M_USB3DRD tristate 'Renesas USB3.1 DRD controller' depends on ARCH_R9A09G011 || COMPILE_TEST - default USB_XHCI_RZV2M - default USB_RENESAS_USB3 help Renesas USB3.1 DRD controller is a USB DRD controller that supports both host and device switching. @@ -194,8 +192,8 @@ config USB_RZV2M_USB3DRD config USB_RENESAS_USB3 tristate 'Renesas USB3.0 Peripheral controller' depends on ARCH_RENESAS || COMPILE_TEST + depends on USB_RZV2M_USB3DRD || !USB_RZV2M_USB3DRD depends on EXTCON - select USB_RZV2M_USB3DRD if ARCH_R9A09G011 select USB_ROLE_SWITCH help Renesas USB3.0 Peripheral controller is a USB peripheral controller diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 4b5c5b1feb40..cfcc0685b650 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -53,8 +53,6 @@ config USB_XHCI_PCI_RENESAS =20 config USB_XHCI_PLATFORM tristate "Generic xHCI driver for a platform device" - select USB_XHCI_RCAR if ARCH_RENESAS - select USB_XHCI_RZV2M if ARCH_R9A09G011 help Adds an xHCI host driver for a generic platform device, which provides a memory space and an irq. @@ -92,15 +90,16 @@ config USB_XHCI_RCAR tristate "xHCI support for Renesas R-Car SoCs" depends on USB_XHCI_PLATFORM depends on ARCH_RENESAS || COMPILE_TEST + default ARCH_RENESAS help Say 'Y' to enable the support for the xHCI host controller found in Renesas R-Car ARM SoCs. =20 config USB_XHCI_RZV2M - tristate "xHCI support for Renesas RZ/V2M SoC" - depends on USB_XHCI_PLATFORM + bool "xHCI support for Renesas RZ/V2M SoC" + depends on USB_XHCI_RCAR depends on ARCH_R9A09G011 || COMPILE_TEST - select USB_RZV2M_USB3DRD + depends on USB_RZV2M_USB3DRD=3Dy || (USB_RZV2M_USB3DRD=3DUSB_XHCI_RCAR) help Say 'Y' to enable the support for the xHCI host controller found in Renesas RZ/V2M SoC. diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 6b1f9317f116..5a13712f367d 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -25,17 +25,13 @@ xhci-plat-hcd-y :=3D xhci-plat.o ifneq ($(CONFIG_USB_XHCI_MVEBU), ) xhci-plat-hcd-y +=3D xhci-mvebu.o endif -ifneq ($(CONFIG_USB_XHCI_RCAR), ) - xhci-plat-hcd-y +=3D xhci-rcar.o -endif -ifneq ($(CONFIG_USB_XHCI_RZV2M), ) - xhci-plat-hcd-y +=3D xhci-rzv2m.o -endif - ifneq ($(CONFIG_DEBUG_FS),) xhci-hcd-y +=3D xhci-debugfs.o endif =20 +xhci-rcar-hcd-y +=3D xhci-rcar.o +xhci-rcar-hcd-$(CONFIG_USB_XHCI_RZV2M) +=3D xhci-rzv2m.o + obj-$(CONFIG_USB_PCI) +=3D pci-quirks.o =20 obj-$(CONFIG_USB_EHCI_HCD) +=3D ehci-hcd.o @@ -75,6 +71,7 @@ obj-$(CONFIG_USB_XHCI_PCI) +=3D xhci-pci.o obj-$(CONFIG_USB_XHCI_PCI_RENESAS) +=3D xhci-pci-renesas.o obj-$(CONFIG_USB_XHCI_PLATFORM) +=3D xhci-plat-hcd.o obj-$(CONFIG_USB_XHCI_HISTB) +=3D xhci-histb.o +obj-$(CONFIG_USB_XHCI_RCAR) +=3D xhci-rcar-hcd.o obj-$(CONFIG_USB_XHCI_MTK) +=3D xhci-mtk-hcd.o obj-$(CONFIG_USB_XHCI_TEGRA) +=3D xhci-tegra.o obj-$(CONFIG_USB_SL811_HCD) +=3D sl811-hcd.o diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 57269f1f318e..cd17ccab6e00 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -24,8 +24,6 @@ #include "xhci.h" #include "xhci-plat.h" #include "xhci-mvebu.h" -#include "xhci-rcar.h" -#include "xhci-rzv2m.h" =20 static struct hc_driver __read_mostly xhci_plat_hc_driver; =20 @@ -116,21 +114,6 @@ static const struct xhci_plat_priv xhci_plat_marvell_a= rmada3700 =3D { .init_quirk =3D xhci_mvebu_a3700_init_quirk, }; =20 -static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 =3D { - SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V1) -}; - -static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 =3D { - SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V3) -}; - -static const struct xhci_plat_priv xhci_plat_renesas_rzv2m =3D { - .quirks =3D XHCI_NO_64BIT_SUPPORT | XHCI_TRUST_TX_LENGTH | - XHCI_SLOW_SUSPEND, - .init_quirk =3D xhci_rzv2m_init_quirk, - .plat_start =3D xhci_rzv2m_start, -}; - static const struct xhci_plat_priv xhci_plat_brcm =3D { .quirks =3D XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS, }; @@ -149,30 +132,6 @@ static const struct of_device_id usb_xhci_of_match[] = =3D { }, { .compatible =3D "marvell,armada3700-xhci", .data =3D &xhci_plat_marvell_armada3700, - }, { - .compatible =3D "renesas,xhci-r8a7790", - .data =3D &xhci_plat_renesas_rcar_gen2, - }, { - .compatible =3D "renesas,xhci-r8a7791", - .data =3D &xhci_plat_renesas_rcar_gen2, - }, { - .compatible =3D "renesas,xhci-r8a7793", - .data =3D &xhci_plat_renesas_rcar_gen2, - }, { - .compatible =3D "renesas,xhci-r8a7795", - .data =3D &xhci_plat_renesas_rcar_gen3, - }, { - .compatible =3D "renesas,xhci-r8a7796", - .data =3D &xhci_plat_renesas_rcar_gen3, - }, { - .compatible =3D "renesas,rcar-gen2-xhci", - .data =3D &xhci_plat_renesas_rcar_gen2, - }, { - .compatible =3D "renesas,rcar-gen3-xhci", - .data =3D &xhci_plat_renesas_rcar_gen3, - }, { - .compatible =3D "renesas,rzv2m-xhci", - .data =3D &xhci_plat_renesas_rzv2m, }, { .compatible =3D "brcm,xhci-brcm-v2", .data =3D &xhci_plat_brcm, @@ -185,11 +144,10 @@ static const struct of_device_id usb_xhci_of_match[] = =3D { MODULE_DEVICE_TABLE(of, usb_xhci_of_match); #endif =20 -static int xhci_plat_probe(struct platform_device *pdev) +int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, c= onst struct xhci_plat_priv *priv_match) { - const struct xhci_plat_priv *priv_match; const struct hc_driver *driver; - struct device *sysdev, *tmpdev; + struct device *tmpdev; struct xhci_hcd *xhci; struct resource *res; struct usb_hcd *hcd, *usb3_hcd; @@ -207,31 +165,10 @@ static int xhci_plat_probe(struct platform_device *pd= ev) if (irq < 0) return irq; =20 - /* - * sysdev must point to a device that is known to the system firmware - * or PCI hardware. We handle these three cases here: - * 1. xhci_plat comes from firmware - * 2. xhci_plat is child of a device from firmware (dwc3-plat) - * 3. xhci_plat is grandchild of a pci device (dwc3-pci) - */ - for (sysdev =3D &pdev->dev; sysdev; sysdev =3D sysdev->parent) { - if (is_of_node(sysdev->fwnode) || - is_acpi_device_node(sysdev->fwnode)) - break; -#ifdef CONFIG_PCI - else if (sysdev->bus =3D=3D &pci_bus_type) - break; -#endif - } - if (!sysdev) sysdev =3D &pdev->dev; =20 - if (WARN_ON(!sysdev->dma_mask)) - /* Platform did not initialize dma_mask */ - ret =3D dma_coerce_mask_and_coherent(sysdev, DMA_BIT_MASK(64)); - else - ret =3D dma_set_mask_and_coherent(sysdev, DMA_BIT_MASK(64)); + ret =3D dma_set_mask_and_coherent(sysdev, DMA_BIT_MASK(64)); if (ret) return ret; =20 @@ -293,11 +230,6 @@ static int xhci_plat_probe(struct platform_device *pde= v) if (ret) goto disable_reg_clk; =20 - if (pdev->dev.of_node) - priv_match =3D of_device_get_match_data(&pdev->dev); - else - priv_match =3D dev_get_platdata(&pdev->dev); - if (priv_match) { priv =3D hcd_to_xhci_priv(hcd); /* Just copy data for now */ @@ -411,8 +343,47 @@ static int xhci_plat_probe(struct platform_device *pde= v) =20 return ret; } +EXPORT_SYMBOL_GPL(xhci_plat_probe); + +static int xhci_generic_plat_probe(struct platform_device *pdev) +{ + const struct xhci_plat_priv *priv_match; + struct device *sysdev; + int ret; + + /* + * sysdev must point to a device that is known to the system firmware + * or PCI hardware. We handle these three cases here: + * 1. xhci_plat comes from firmware + * 2. xhci_plat is child of a device from firmware (dwc3-plat) + * 3. xhci_plat is grandchild of a pci device (dwc3-pci) + */ + for (sysdev =3D &pdev->dev; sysdev; sysdev =3D sysdev->parent) { + if (is_of_node(sysdev->fwnode) || + is_acpi_device_node(sysdev->fwnode)) + break; +#ifdef CONFIG_PCI + else if (sysdev->bus =3D=3D &pci_bus_type) + break; +#endif + } + + if (WARN_ON(!sysdev->dma_mask)) { + /* Platform did not initialize dma_mask */ + ret =3D dma_coerce_mask_and_coherent(sysdev, DMA_BIT_MASK(64)); + if (ret) + return ret; + } + + if (pdev->dev.of_node) + priv_match =3D of_device_get_match_data(&pdev->dev); + else + priv_match =3D dev_get_platdata(&pdev->dev); + + return xhci_plat_probe(pdev, sysdev, priv_match); +} =20 -static int xhci_plat_remove(struct platform_device *dev) +int xhci_plat_remove(struct platform_device *dev) { struct usb_hcd *hcd =3D platform_get_drvdata(dev); struct xhci_hcd *xhci =3D hcd_to_xhci(hcd); @@ -446,6 +417,7 @@ static int xhci_plat_remove(struct platform_device *dev) =20 return 0; } +EXPORT_SYMBOL_GPL(xhci_plat_remove); =20 static int __maybe_unused xhci_plat_suspend(struct device *dev) { @@ -522,13 +494,14 @@ static int __maybe_unused xhci_plat_runtime_resume(st= ruct device *dev) return xhci_resume(xhci, 0); } =20 -static const struct dev_pm_ops xhci_plat_pm_ops =3D { +const struct dev_pm_ops xhci_plat_pm_ops =3D { SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume) =20 SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume, NULL) }; +EXPORT_SYMBOL_GPL(xhci_plat_pm_ops); =20 #ifdef CONFIG_ACPI static const struct acpi_device_id usb_xhci_acpi_match[] =3D { @@ -539,8 +512,8 @@ static const struct acpi_device_id usb_xhci_acpi_match[= ] =3D { MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); #endif =20 -static struct platform_driver usb_xhci_driver =3D { - .probe =3D xhci_plat_probe, +static struct platform_driver usb_generic_xhci_driver =3D { + .probe =3D xhci_generic_plat_probe, .remove =3D xhci_plat_remove, .shutdown =3D usb_hcd_platform_shutdown, .driver =3D { @@ -555,13 +528,13 @@ MODULE_ALIAS("platform:xhci-hcd"); static int __init xhci_plat_init(void) { xhci_init_driver(&xhci_plat_hc_driver, &xhci_plat_overrides); - return platform_driver_register(&usb_xhci_driver); + return platform_driver_register(&usb_generic_xhci_driver); } module_init(xhci_plat_init); =20 static void __exit xhci_plat_exit(void) { - platform_driver_unregister(&usb_xhci_driver); + platform_driver_unregister(&usb_generic_xhci_driver); } module_exit(xhci_plat_exit); =20 diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h index 1fb149d1fbce..83b5b5aa9f8e 100644 --- a/drivers/usb/host/xhci-plat.h +++ b/drivers/usb/host/xhci-plat.h @@ -21,4 +21,11 @@ struct xhci_plat_priv { =20 #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv) #define xhci_to_priv(x) ((struct xhci_plat_priv *)(x)->priv) + +int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, + const struct xhci_plat_priv *priv_match); + +int xhci_plat_remove(struct platform_device *dev); +extern const struct dev_pm_ops xhci_plat_pm_ops; + #endif /* _XHCI_PLAT_H */ diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index aef0258a7160..7f18509a1d39 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -10,12 +10,17 @@ #include #include #include +#include #include #include =20 #include "xhci.h" #include "xhci-plat.h" -#include "xhci-rcar.h" +#include "xhci-rzv2m.h" + +#define XHCI_RCAR_FIRMWARE_NAME_V1 "r8a779x_usb3_v1.dlmem" +#define XHCI_RCAR_FIRMWARE_NAME_V2 "r8a779x_usb3_v2.dlmem" +#define XHCI_RCAR_FIRMWARE_NAME_V3 "r8a779x_usb3_v3.dlmem" =20 /* * - The V3 firmware is for almost all R-Car Gen3 (except r8a7795 ES1.x) @@ -108,7 +113,7 @@ static int xhci_rcar_is_gen2(struct device *dev) of_device_is_compatible(node, "renesas,rcar-gen2-xhci"); } =20 -void xhci_rcar_start(struct usb_hcd *hcd) +static void xhci_rcar_start(struct usb_hcd *hcd) { u32 temp; =20 @@ -203,7 +208,7 @@ static bool xhci_rcar_wait_for_pll_active(struct usb_hc= d *hcd) } =20 /* This function needs to initialize a "phy" of usb before */ -int xhci_rcar_init_quirk(struct usb_hcd *hcd) +static int xhci_rcar_init_quirk(struct usb_hcd *hcd) { /* If hcd->regs is NULL, we don't just call the following function */ if (!hcd->regs) @@ -215,7 +220,7 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd) return xhci_rcar_download_firmware(hcd); } =20 -int xhci_rcar_resume_quirk(struct usb_hcd *hcd) +static int xhci_rcar_resume_quirk(struct usb_hcd *hcd) { int ret; =20 @@ -225,3 +230,92 @@ int xhci_rcar_resume_quirk(struct usb_hcd *hcd) =20 return ret; } + +/* + * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set + * to 1. However, these SoCs don't support 64-bit address memory + * pointers. So, this driver clears the AC64 bit of xhci->hcc_params + * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in + * xhci_gen_setup() by using the XHCI_NO_64BIT_SUPPORT quirk. + * + * And, since the firmware/internal CPU control the USBSTS.STS_HALT + * and the process speed is down when the roothub port enters U3, + * long delay for the handshake of STS_HALT is neeed in xhci_suspend() + * by using the XHCI_SLOW_SUSPEND quirk. + */ +#define SET_XHCI_PLAT_PRIV_FOR_RCAR(firmware) \ + .firmware_name =3D firmware, \ + .quirks =3D XHCI_NO_64BIT_SUPPORT | XHCI_TRUST_TX_LENGTH | \ + XHCI_SLOW_SUSPEND, \ + .init_quirk =3D xhci_rcar_init_quirk, \ + .plat_start =3D xhci_rcar_start, \ + .resume_quirk =3D xhci_rcar_resume_quirk, + +static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 =3D { + SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V1) +}; + +static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 =3D { + SET_XHCI_PLAT_PRIV_FOR_RCAR(XHCI_RCAR_FIRMWARE_NAME_V3) +}; + +static const struct xhci_plat_priv xhci_plat_renesas_rzv2m =3D { + .quirks =3D XHCI_NO_64BIT_SUPPORT | XHCI_TRUST_TX_LENGTH | + XHCI_SLOW_SUSPEND, + .init_quirk =3D xhci_rzv2m_init_quirk, + .plat_start =3D xhci_rzv2m_start, +}; + +static const struct of_device_id usb_xhci_of_match[] =3D { + { + .compatible =3D "renesas,xhci-r8a7790", + .data =3D &xhci_plat_renesas_rcar_gen2, + }, { + .compatible =3D "renesas,xhci-r8a7791", + .data =3D &xhci_plat_renesas_rcar_gen2, + }, { + .compatible =3D "renesas,xhci-r8a7793", + .data =3D &xhci_plat_renesas_rcar_gen2, + }, { + .compatible =3D "renesas,xhci-r8a7795", + .data =3D &xhci_plat_renesas_rcar_gen3, + }, { + .compatible =3D "renesas,xhci-r8a7796", + .data =3D &xhci_plat_renesas_rcar_gen3, + }, { + .compatible =3D "renesas,rcar-gen2-xhci", + .data =3D &xhci_plat_renesas_rcar_gen2, + }, { + .compatible =3D "renesas,rcar-gen3-xhci", + .data =3D &xhci_plat_renesas_rcar_gen3, + }, { + .compatible =3D "renesas,rzv2m-xhci", + .data =3D &xhci_plat_renesas_rzv2m, + }, + { }, +}; +MODULE_DEVICE_TABLE(of, usb_xhci_of_match); + +static int xhci_renesas_probe(struct platform_device *pdev) +{ + const struct xhci_plat_priv *priv_match; + + priv_match =3D of_device_get_match_data(&pdev->dev); + + return xhci_plat_probe(pdev, NULL, priv_match); +} + +static struct platform_driver usb_xhci_renesas_driver =3D { + .probe =3D xhci_renesas_probe, + .remove =3D xhci_plat_remove, + .shutdown =3D usb_hcd_platform_shutdown, + .driver =3D { + .name =3D "xhci-renesas-hcd", + .pm =3D &xhci_plat_pm_ops, + .of_match_table =3D of_match_ptr(usb_xhci_of_match), + }, +}; +module_platform_driver(usb_xhci_renesas_driver); + +MODULE_DESCRIPTION("xHCI Platform Host Controller Driver for Renesas R-Car= and RZ"); +MODULE_LICENSE("GPL"); diff --git a/drivers/usb/host/xhci-rcar.h b/drivers/usb/host/xhci-rcar.h deleted file mode 100644 index 048ad3b8a6c7..000000000000 --- a/drivers/usb/host/xhci-rcar.h +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * drivers/usb/host/xhci-rcar.h - * - * Copyright (C) 2014 Renesas Electronics Corporation - */ - -#ifndef _XHCI_RCAR_H -#define _XHCI_RCAR_H - -#define XHCI_RCAR_FIRMWARE_NAME_V1 "r8a779x_usb3_v1.dlmem" -#define XHCI_RCAR_FIRMWARE_NAME_V2 "r8a779x_usb3_v2.dlmem" -#define XHCI_RCAR_FIRMWARE_NAME_V3 "r8a779x_usb3_v3.dlmem" - -#if IS_ENABLED(CONFIG_USB_XHCI_RCAR) -void xhci_rcar_start(struct usb_hcd *hcd); -int xhci_rcar_init_quirk(struct usb_hcd *hcd); -int xhci_rcar_resume_quirk(struct usb_hcd *hcd); -#else -static inline void xhci_rcar_start(struct usb_hcd *hcd) -{ -} - -static inline int xhci_rcar_init_quirk(struct usb_hcd *hcd) -{ - return 0; -} - -static inline int xhci_rcar_resume_quirk(struct usb_hcd *hcd) -{ - return 0; -} -#endif - -/* - * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set - * to 1. However, these SoCs don't support 64-bit address memory - * pointers. So, this driver clears the AC64 bit of xhci->hcc_params - * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in - * xhci_gen_setup() by using the XHCI_NO_64BIT_SUPPORT quirk. - * - * And, since the firmware/internal CPU control the USBSTS.STS_HALT - * and the process speed is down when the roothub port enters U3, - * long delay for the handshake of STS_HALT is neeed in xhci_suspend() - * by using the XHCI_SLOW_SUSPEND quirk. - */ -#define SET_XHCI_PLAT_PRIV_FOR_RCAR(firmware) \ - .firmware_name =3D firmware, \ - .quirks =3D XHCI_NO_64BIT_SUPPORT | XHCI_TRUST_TX_LENGTH | \ - XHCI_SLOW_SUSPEND, \ - .init_quirk =3D xhci_rcar_init_quirk, \ - .plat_start =3D xhci_rcar_start, \ - .resume_quirk =3D xhci_rcar_resume_quirk, - -#endif /* _XHCI_RCAR_H */ --=20 2.39.0