mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
usb: cdns3: Add USBSSP platform driver support
Expose Cadence USBSSP through the same platform path as USBSS, trim Kconfig and Makefile: one core loadable object plus separate glue .ko files. Single cdns.ko bundles core, DRD, the generic "cdns,usb3" platform driver in cdns3-plat.c, optional host.o, and optional gadget objects. Use CONFIG_USB_CDNS3_GADGET as a bool to compile gadget support into that module. Remove duplicate MODULE_* declarations from cdns3-plat.c now that it links into the same module. Kconfig: the generic platform driver is selected via CONFIG_USB_CDNS3. Move CONFIG_USB_CDNSP_PCI beside CONFIG_USB_CDNS3_PCI_WRAP under "Platform glue driver support". SoC glue entries (TI, i.MX, StarFive) depend only on CONFIG_USB_CDNS3. Tighten CONFIG_USB_CDNS_SUPPORT dependencies so the umbrella follows host or gadget when either is built as a module. Match host and gadget bools to the cdns.ko tristate with USB=USB_CDNS3 and USB_GADGET=USB_CDNS3 instead of comparing against USB_CDNS_SUPPORT. Link host.o when CONFIG_USB_CDNS3_HOST is enabled and use that symbol in host-export.h, removing the redundant CONFIG_USB_CDNS_HOST indirection. Export cdns_core_init_role and reorganize the function cdns_init, and controller version could be gotten before the gadget init function is decided per controller. Keep host_init / gadget_init callbacks in struct cdns, so core.c does not need direct linkage to host or gadget objects. Refactor cdnsp-pci.c into a thin PCI-to-platform wrapper. drivers/usb/Makefile: descend into drivers/usb/cdns3/ only when CONFIG_USB_CDNS_SUPPORT is enabled. Assisted-by: Cursor:claude-4.6-opus Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Peter Chen <peter.chen@cixtech.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20260421023459.506145-3-peter.chen@cixtech.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b379998c82
commit
e4d7362dc9
|
|
@ -14,8 +14,6 @@ obj-$(CONFIG_USB_DWC2) += dwc2/
|
||||||
obj-$(CONFIG_USB_ISP1760) += isp1760/
|
obj-$(CONFIG_USB_ISP1760) += isp1760/
|
||||||
|
|
||||||
obj-$(CONFIG_USB_CDNS_SUPPORT) += cdns3/
|
obj-$(CONFIG_USB_CDNS_SUPPORT) += cdns3/
|
||||||
obj-$(CONFIG_USB_CDNS3) += cdns3/
|
|
||||||
obj-$(CONFIG_USB_CDNSP_PCI) += cdns3/
|
|
||||||
|
|
||||||
obj-$(CONFIG_USB_FOTG210) += fotg210/
|
obj-$(CONFIG_USB_FOTG210) += fotg210/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
config USB_CDNS_SUPPORT
|
config USB_CDNS_SUPPORT
|
||||||
tristate "Cadence USB Support"
|
tristate "Cadence USB Support"
|
||||||
depends on USB_SUPPORT && (USB || USB_GADGET) && HAS_DMA
|
depends on USB_SUPPORT && HAS_DMA
|
||||||
|
depends on USB || USB_GADGET
|
||||||
|
depends on USB if !USB_GADGET
|
||||||
|
depends on USB_GADGET if !USB
|
||||||
select USB_XHCI_PLATFORM if USB_XHCI_HCD
|
select USB_XHCI_PLATFORM if USB_XHCI_HCD
|
||||||
select USB_ROLE_SWITCH
|
select USB_ROLE_SWITCH
|
||||||
help
|
help
|
||||||
|
|
@ -8,44 +11,49 @@ config USB_CDNS_SUPPORT
|
||||||
dual-role controller.
|
dual-role controller.
|
||||||
It supports: dual-role switch, Host-only, and Peripheral-only.
|
It supports: dual-role switch, Host-only, and Peripheral-only.
|
||||||
|
|
||||||
config USB_CDNS_HOST
|
|
||||||
bool
|
|
||||||
|
|
||||||
if USB_CDNS_SUPPORT
|
if USB_CDNS_SUPPORT
|
||||||
|
|
||||||
config USB_CDNS3
|
config USB_CDNS3
|
||||||
tristate "Cadence USB3 Dual-Role Controller"
|
tristate "Cadence USB dual-role controller (USBSS and USBSSP)"
|
||||||
depends on USB_CDNS_SUPPORT
|
depends on USB_CDNS_SUPPORT
|
||||||
help
|
help
|
||||||
Say Y here if your system has a Cadence USB3 dual-role controller.
|
Say Y or M here if your system has an on-chip Cadence USB
|
||||||
It supports: dual-role switch, Host-only, and Peripheral-only.
|
dual-role controller. This covers both USBSS (USB 3.0) and
|
||||||
|
USBSSP (SuperSpeed Plus) IP; the driver detects the variant at
|
||||||
|
runtime.
|
||||||
|
|
||||||
If you choose to build this driver is a dynamically linked
|
The core driver (core, DRD, generic platform binding for the
|
||||||
as module, the module will be called cdns3.ko.
|
"cdns,usb3" device tree compatible, optional host and gadget)
|
||||||
endif
|
builds as one module named cdns.ko when built as a loadable
|
||||||
|
module.
|
||||||
|
|
||||||
|
It supports: dual-role switch, Host-only, and Peripheral-only.
|
||||||
|
|
||||||
if USB_CDNS3
|
if USB_CDNS3
|
||||||
|
|
||||||
|
config USB_CDNS3_HOST
|
||||||
|
bool "Cadence USB host controller (xHCI)"
|
||||||
|
depends on USB=y || USB=USB_CDNS3
|
||||||
|
help
|
||||||
|
Say Y here to enable host controller functionality for Cadence
|
||||||
|
USBSS and USBSSP dual-role controllers.
|
||||||
|
|
||||||
|
The host controller is xHCI compliant and uses the standard
|
||||||
|
xHCI driver.
|
||||||
|
|
||||||
config USB_CDNS3_GADGET
|
config USB_CDNS3_GADGET
|
||||||
bool "Cadence USB3 device controller"
|
bool "Cadence USB device controller (USBSS and USBSSP)"
|
||||||
depends on USB_GADGET=y || USB_GADGET=USB_CDNS3
|
depends on USB_GADGET=y || USB_GADGET=USB_CDNS3
|
||||||
help
|
help
|
||||||
Say Y here to enable device controller functionality of the
|
Say Y here to include Cadence USB device (gadget) support for
|
||||||
Cadence USBSS-DEV driver.
|
both USBSS (USB 3.0) and USBSSP (SuperSpeed Plus) IP in the
|
||||||
|
cdns.ko module. The implementation is selected at runtime from
|
||||||
|
the detected controller version.
|
||||||
|
|
||||||
This controller supports FF, HS and SS mode. It doesn't support
|
USBSS gadget supports FF, HS and SS mode (not LS or SSP).
|
||||||
LS and SSP mode.
|
USBSSP gadget supports FF, HS, SS and SSP mode (not LS).
|
||||||
|
|
||||||
config USB_CDNS3_HOST
|
comment "Platform glue driver support"
|
||||||
bool "Cadence USB3 host controller"
|
|
||||||
depends on USB=y || USB=USB_CDNS3
|
|
||||||
select USB_CDNS_HOST
|
|
||||||
help
|
|
||||||
Say Y here to enable host controller functionality of the
|
|
||||||
Cadence driver.
|
|
||||||
|
|
||||||
Host controller is compliant with XHCI so it will use
|
|
||||||
standard XHCI driver.
|
|
||||||
|
|
||||||
config USB_CDNS3_PCI_WRAP
|
config USB_CDNS3_PCI_WRAP
|
||||||
tristate "Cadence USB3 support on PCIe-based platforms"
|
tristate "Cadence USB3 support on PCIe-based platforms"
|
||||||
|
|
@ -58,6 +66,17 @@ config USB_CDNS3_PCI_WRAP
|
||||||
If you choose to build this driver as module it will
|
If you choose to build this driver as module it will
|
||||||
be dynamically linked and module will be called cdns3-pci.ko
|
be dynamically linked and module will be called cdns3-pci.ko
|
||||||
|
|
||||||
|
config USB_CDNSP_PCI
|
||||||
|
tristate "Cadence USBSSP support on PCIe-based platforms"
|
||||||
|
depends on USB_PCI && ACPI
|
||||||
|
default USB_CDNS3
|
||||||
|
help
|
||||||
|
If you're using the USBSSP Core IP with a PCIe, please say
|
||||||
|
'Y' or 'M' here.
|
||||||
|
|
||||||
|
If you choose to build this driver as module it will
|
||||||
|
be dynamically linked and module will be called cdnsp-pci.ko
|
||||||
|
|
||||||
config USB_CDNS3_TI
|
config USB_CDNS3_TI
|
||||||
tristate "Cadence USB3 support on TI platforms"
|
tristate "Cadence USB3 support on TI platforms"
|
||||||
depends on ARCH_K3 || COMPILE_TEST
|
depends on ARCH_K3 || COMPILE_TEST
|
||||||
|
|
@ -81,6 +100,7 @@ config USB_CDNS3_IMX
|
||||||
config USB_CDNS3_STARFIVE
|
config USB_CDNS3_STARFIVE
|
||||||
tristate "Cadence USB3 support on StarFive SoC platforms"
|
tristate "Cadence USB3 support on StarFive SoC platforms"
|
||||||
depends on ARCH_STARFIVE || COMPILE_TEST
|
depends on ARCH_STARFIVE || COMPILE_TEST
|
||||||
|
default USB_CDNS3
|
||||||
help
|
help
|
||||||
Say 'Y' or 'M' here if you are building for StarFive SoCs
|
Say 'Y' or 'M' here if you are building for StarFive SoCs
|
||||||
platforms that contain Cadence USB3 controller core.
|
platforms that contain Cadence USB3 controller core.
|
||||||
|
|
@ -89,45 +109,7 @@ config USB_CDNS3_STARFIVE
|
||||||
|
|
||||||
If you choose to build this driver as module it will
|
If you choose to build this driver as module it will
|
||||||
be dynamically linked and module will be called cdns3-starfive.ko
|
be dynamically linked and module will be called cdns3-starfive.ko
|
||||||
endif
|
|
||||||
|
|
||||||
if USB_CDNS_SUPPORT
|
endif # USB_CDNS3
|
||||||
|
|
||||||
config USB_CDNSP_PCI
|
endif # USB_CDNS_SUPPORT
|
||||||
tristate "Cadence CDNSP Dual-Role Controller"
|
|
||||||
depends on USB_CDNS_SUPPORT && USB_PCI && ACPI
|
|
||||||
help
|
|
||||||
Say Y here if your system has a Cadence CDNSP dual-role controller.
|
|
||||||
It supports: dual-role switch Host-only, and Peripheral-only.
|
|
||||||
|
|
||||||
If you choose to build this driver is a dynamically linked
|
|
||||||
module, the module will be called cdnsp.ko.
|
|
||||||
endif
|
|
||||||
|
|
||||||
if USB_CDNSP_PCI
|
|
||||||
|
|
||||||
config USB_CDNSP_GADGET
|
|
||||||
bool "Cadence CDNSP device controller"
|
|
||||||
depends on USB_GADGET=y || USB_GADGET=USB_CDNSP_PCI
|
|
||||||
help
|
|
||||||
Say Y here to enable device controller functionality of the
|
|
||||||
Cadence CDNSP-DEV driver.
|
|
||||||
|
|
||||||
Cadence CDNSP Device Controller in device mode is
|
|
||||||
very similar to XHCI controller. Therefore some algorithms
|
|
||||||
used has been taken from host driver.
|
|
||||||
This controller supports FF, HS, SS and SSP mode.
|
|
||||||
It doesn't support LS.
|
|
||||||
|
|
||||||
config USB_CDNSP_HOST
|
|
||||||
bool "Cadence CDNSP host controller"
|
|
||||||
depends on USB=y || USB=USB_CDNSP_PCI
|
|
||||||
select USB_CDNS_HOST
|
|
||||||
help
|
|
||||||
Say Y here to enable host controller functionality of the
|
|
||||||
Cadence driver.
|
|
||||||
|
|
||||||
Host controller is compliant with XHCI so it uses
|
|
||||||
standard XHCI driver.
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
|
||||||
|
|
@ -3,42 +3,28 @@
|
||||||
CFLAGS_cdns3-trace.o := -I$(src)
|
CFLAGS_cdns3-trace.o := -I$(src)
|
||||||
CFLAGS_cdnsp-trace.o := -I$(src)
|
CFLAGS_cdnsp-trace.o := -I$(src)
|
||||||
|
|
||||||
cdns-usb-common-y := core.o drd.o
|
obj-$(CONFIG_USB_CDNS3) += cdns.o
|
||||||
cdns3-y := cdns3-plat.o
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_USB),m)
|
cdns-y := core.o drd.o cdns3-plat.o
|
||||||
obj-m += cdns-usb-common.o
|
cdns-$(CONFIG_USB_CDNS3_HOST) += host.o
|
||||||
obj-m += cdns3.o
|
|
||||||
else
|
|
||||||
obj-$(CONFIG_USB_CDNS_SUPPORT) += cdns-usb-common.o
|
|
||||||
obj-$(CONFIG_USB_CDNS3) += cdns3.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
cdns-usb-common-$(CONFIG_USB_CDNS_HOST) += host.o
|
|
||||||
cdns3-$(CONFIG_USB_CDNS3_GADGET) += cdns3-gadget.o cdns3-ep0.o
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_USB_CDNS3_GADGET),)
|
ifneq ($(CONFIG_USB_CDNS3_GADGET),)
|
||||||
cdns3-$(CONFIG_TRACING) += cdns3-trace.o
|
cdns-y += cdns3-gadget.o cdns3-ep0.o \
|
||||||
|
cdnsp-ring.o cdnsp-gadget.o \
|
||||||
|
cdnsp-mem.o cdnsp-ep0.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_TRACING),)
|
||||||
|
ifneq ($(CONFIG_USB_CDNS3_GADGET),)
|
||||||
|
cdns-y += cdns3-trace.o cdnsp-trace.o
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
##
|
||||||
|
# Platform-specific glue layers (PCI wrappers, SoC integration)
|
||||||
|
##
|
||||||
obj-$(CONFIG_USB_CDNS3_PCI_WRAP) += cdns3-pci-wrap.o
|
obj-$(CONFIG_USB_CDNS3_PCI_WRAP) += cdns3-pci-wrap.o
|
||||||
|
obj-$(CONFIG_USB_CDNSP_PCI) += cdnsp-pci.o
|
||||||
obj-$(CONFIG_USB_CDNS3_TI) += cdns3-ti.o
|
obj-$(CONFIG_USB_CDNS3_TI) += cdns3-ti.o
|
||||||
obj-$(CONFIG_USB_CDNS3_IMX) += cdns3-imx.o
|
obj-$(CONFIG_USB_CDNS3_IMX) += cdns3-imx.o
|
||||||
obj-$(CONFIG_USB_CDNS3_STARFIVE) += cdns3-starfive.o
|
obj-$(CONFIG_USB_CDNS3_STARFIVE) += cdns3-starfive.o
|
||||||
|
|
||||||
cdnsp-udc-pci-y := cdnsp-pci.o
|
|
||||||
|
|
||||||
ifdef CONFIG_USB_CDNSP_PCI
|
|
||||||
ifeq ($(CONFIG_USB),m)
|
|
||||||
obj-m += cdnsp-udc-pci.o
|
|
||||||
else
|
|
||||||
obj-$(CONFIG_USB_CDNSP_PCI) += cdnsp-udc-pci.o
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
cdnsp-udc-pci-$(CONFIG_USB_CDNSP_GADGET) += cdnsp-ring.o cdnsp-gadget.o \
|
|
||||||
cdnsp-mem.o cdnsp-ep0.o
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_USB_CDNSP_GADGET),)
|
|
||||||
cdnsp-udc-pci-$(CONFIG_TRACING) += cdnsp-trace.o
|
|
||||||
endif
|
|
||||||
|
|
|
||||||
|
|
@ -3512,3 +3512,4 @@ int cdns3_gadget_init(struct cdns *cdns)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cdns3_gadget_init);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "gadget-export.h"
|
#include "gadget-export.h"
|
||||||
|
#include "host-export.h"
|
||||||
#include "drd.h"
|
#include "drd.h"
|
||||||
|
|
||||||
static int set_phy_power_on(struct cdns *cdns)
|
static int set_phy_power_on(struct cdns *cdns)
|
||||||
|
|
@ -44,6 +45,19 @@ static void set_phy_power_off(struct cdns *cdns)
|
||||||
phy_power_off(cdns->usb2_phy);
|
phy_power_off(cdns->usb2_phy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cdns3_plat_gadget_init(struct cdns *cdns)
|
||||||
|
{
|
||||||
|
if (cdns->version < CDNSP_CONTROLLER_V2)
|
||||||
|
return cdns3_gadget_init(cdns);
|
||||||
|
else
|
||||||
|
return cdnsp_gadget_init(cdns);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cdns3_plat_host_init(struct cdns *cdns)
|
||||||
|
{
|
||||||
|
return cdns_host_init(cdns);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cdns3_plat_probe - probe for cdns3 core device
|
* cdns3_plat_probe - probe for cdns3 core device
|
||||||
* @pdev: Pointer to cdns3 core platform device
|
* @pdev: Pointer to cdns3 core platform device
|
||||||
|
|
@ -64,6 +78,8 @@ static int cdns3_plat_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
cdns->dev = dev;
|
cdns->dev = dev;
|
||||||
cdns->pdata = dev_get_platdata(dev);
|
cdns->pdata = dev_get_platdata(dev);
|
||||||
|
if (cdns->pdata && cdns->pdata->override_apb_timeout)
|
||||||
|
cdns->override_apb_timeout = cdns->pdata->override_apb_timeout;
|
||||||
|
|
||||||
platform_set_drvdata(pdev, cdns);
|
platform_set_drvdata(pdev, cdns);
|
||||||
|
|
||||||
|
|
@ -143,12 +159,16 @@ static int cdns3_plat_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_phy_power_on;
|
goto err_phy_power_on;
|
||||||
|
|
||||||
cdns->gadget_init = cdns3_gadget_init;
|
|
||||||
|
|
||||||
ret = cdns_init(cdns);
|
ret = cdns_init(cdns);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_cdns_init;
|
goto err_cdns_init;
|
||||||
|
|
||||||
|
cdns->gadget_init = cdns3_plat_gadget_init;
|
||||||
|
cdns->host_init = cdns3_plat_host_init;
|
||||||
|
ret = cdns_core_init_role(cdns);
|
||||||
|
if (ret)
|
||||||
|
goto err_cdns_init;
|
||||||
|
|
||||||
device_set_wakeup_capable(dev, true);
|
device_set_wakeup_capable(dev, true);
|
||||||
pm_runtime_set_active(dev);
|
pm_runtime_set_active(dev);
|
||||||
pm_runtime_enable(dev);
|
pm_runtime_enable(dev);
|
||||||
|
|
@ -336,6 +356,3 @@ static struct platform_driver cdns3_driver = {
|
||||||
module_platform_driver(cdns3_driver);
|
module_platform_driver(cdns3_driver);
|
||||||
|
|
||||||
MODULE_ALIAS("platform:cdns3");
|
MODULE_ALIAS("platform:cdns3");
|
||||||
MODULE_AUTHOR("Pawel Laszczak <pawell@cadence.com>");
|
|
||||||
MODULE_LICENSE("GPL v2");
|
|
||||||
MODULE_DESCRIPTION("Cadence USB3 DRD Controller Driver");
|
|
||||||
|
|
|
||||||
|
|
@ -2092,3 +2092,4 @@ int cdnsp_gadget_init(struct cdns *cdns)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cdnsp_gadget_init);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
/*
|
/*
|
||||||
* Cadence PCI Glue driver.
|
* Cadence USBSSP PCI Glue driver.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Cadence.
|
* Copyright (C) 2019 Cadence.
|
||||||
*
|
*
|
||||||
|
|
@ -16,7 +16,19 @@
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "gadget-export.h"
|
|
||||||
|
struct cdnsp_wrap {
|
||||||
|
struct platform_device *plat_dev;
|
||||||
|
struct resource dev_res[6];
|
||||||
|
int devfn;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RES_IRQ_HOST_ID 0
|
||||||
|
#define RES_IRQ_PERIPHERAL_ID 1
|
||||||
|
#define RES_IRQ_OTG_ID 2
|
||||||
|
#define RES_HOST_ID 3
|
||||||
|
#define RES_DEV_ID 4
|
||||||
|
#define RES_DRD_ID 5
|
||||||
|
|
||||||
#define PCI_BAR_HOST 0
|
#define PCI_BAR_HOST 0
|
||||||
#define PCI_BAR_OTG 0
|
#define PCI_BAR_OTG 0
|
||||||
|
|
@ -26,16 +38,16 @@
|
||||||
#define PCI_DEV_FN_OTG 1
|
#define PCI_DEV_FN_OTG 1
|
||||||
|
|
||||||
#define PCI_DRIVER_NAME "cdns-pci-usbssp"
|
#define PCI_DRIVER_NAME "cdns-pci-usbssp"
|
||||||
#define PLAT_DRIVER_NAME "cdns-usbssp"
|
#define PLAT_DRIVER_NAME "cdns-usb3"
|
||||||
|
|
||||||
#define CHICKEN_APB_TIMEOUT_VALUE 0x1C20
|
#define CHICKEN_APB_TIMEOUT_VALUE 0x1C20
|
||||||
|
|
||||||
static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
|
static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Gets the second function.
|
* Gets the second function.
|
||||||
* Platform has two function. The fist keeps resources for
|
* Platform has two function. The first keeps resources for
|
||||||
* Host/Device while the secon keeps resources for DRD/OTG.
|
* Host/Device while the second keeps resources for DRD/OTG.
|
||||||
*/
|
*/
|
||||||
if (pdev->device == PCI_DEVICE_ID_CDNS_USBSSP)
|
if (pdev->device == PCI_DEVICE_ID_CDNS_USBSSP)
|
||||||
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USBSS, NULL);
|
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USBSS, NULL);
|
||||||
|
|
@ -48,11 +60,12 @@ static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
|
||||||
static int cdnsp_pci_probe(struct pci_dev *pdev,
|
static int cdnsp_pci_probe(struct pci_dev *pdev,
|
||||||
const struct pci_device_id *id)
|
const struct pci_device_id *id)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct platform_device_info plat_info;
|
||||||
struct pci_dev *func;
|
static struct cdns3_platform_data pdata;
|
||||||
|
struct cdnsp_wrap *wrap;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct cdns *cdnsp;
|
struct pci_dev *func;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For GADGET/HOST PCI (devfn) function number is 0,
|
* For GADGET/HOST PCI (devfn) function number is 0,
|
||||||
|
|
@ -79,146 +92,105 @@ static int cdnsp_pci_probe(struct pci_dev *pdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
|
||||||
if (pci_is_enabled(func)) {
|
if (pci_is_enabled(func)) {
|
||||||
cdnsp = pci_get_drvdata(func);
|
wrap = pci_get_drvdata(func);
|
||||||
} else {
|
} else {
|
||||||
cdnsp = kzalloc_obj(*cdnsp);
|
wrap = kzalloc_obj(*wrap);
|
||||||
if (!cdnsp) {
|
if (!wrap) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto put_pci;
|
goto put_pci;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For GADGET device function number is 0. */
|
res = wrap->dev_res;
|
||||||
if (pdev->devfn == 0) {
|
|
||||||
resource_size_t rsrc_start, rsrc_len;
|
|
||||||
|
|
||||||
/* Function 0: host(BAR_0) + device(BAR_1).*/
|
if (pdev->devfn == PCI_DEV_FN_HOST_DEVICE) {
|
||||||
dev_dbg(dev, "Initialize resources\n");
|
/* Function 0: host(BAR_0) + device(BAR_2). */
|
||||||
rsrc_start = pci_resource_start(pdev, PCI_BAR_DEV);
|
dev_dbg(&pdev->dev, "Initialize Device resources\n");
|
||||||
rsrc_len = pci_resource_len(pdev, PCI_BAR_DEV);
|
res[RES_DEV_ID].start = pci_resource_start(pdev, PCI_BAR_DEV);
|
||||||
res = devm_request_mem_region(dev, rsrc_start, rsrc_len, "dev");
|
res[RES_DEV_ID].end = pci_resource_end(pdev, PCI_BAR_DEV);
|
||||||
if (!res) {
|
res[RES_DEV_ID].name = "dev";
|
||||||
dev_dbg(dev, "controller already in use\n");
|
res[RES_DEV_ID].flags = IORESOURCE_MEM;
|
||||||
ret = -EBUSY;
|
dev_dbg(&pdev->dev, "USBSSP-DEV physical base addr: %pa\n",
|
||||||
goto free_cdnsp;
|
&res[RES_DEV_ID].start);
|
||||||
}
|
|
||||||
|
|
||||||
cdnsp->dev_regs = devm_ioremap(dev, rsrc_start, rsrc_len);
|
res[RES_HOST_ID].start = pci_resource_start(pdev, PCI_BAR_HOST);
|
||||||
if (!cdnsp->dev_regs) {
|
res[RES_HOST_ID].end = pci_resource_end(pdev, PCI_BAR_HOST);
|
||||||
dev_dbg(dev, "error mapping memory\n");
|
res[RES_HOST_ID].name = "xhci";
|
||||||
ret = -EFAULT;
|
res[RES_HOST_ID].flags = IORESOURCE_MEM;
|
||||||
goto free_cdnsp;
|
dev_dbg(&pdev->dev, "USBSSP-XHCI physical base addr: %pa\n",
|
||||||
}
|
&res[RES_HOST_ID].start);
|
||||||
|
|
||||||
cdnsp->dev_irq = pdev->irq;
|
/* Interrupt for XHCI */
|
||||||
dev_dbg(dev, "USBSS-DEV physical base addr: %pa\n",
|
wrap->dev_res[RES_IRQ_HOST_ID].start = pdev->irq;
|
||||||
&rsrc_start);
|
wrap->dev_res[RES_IRQ_HOST_ID].name = "host";
|
||||||
|
wrap->dev_res[RES_IRQ_HOST_ID].flags = IORESOURCE_IRQ;
|
||||||
|
|
||||||
res = &cdnsp->xhci_res[0];
|
/* Interrupt for device. It's the same as for HOST. */
|
||||||
res->start = pci_resource_start(pdev, PCI_BAR_HOST);
|
wrap->dev_res[RES_IRQ_PERIPHERAL_ID].start = pdev->irq;
|
||||||
res->end = pci_resource_end(pdev, PCI_BAR_HOST);
|
wrap->dev_res[RES_IRQ_PERIPHERAL_ID].name = "peripheral";
|
||||||
res->name = "xhci";
|
wrap->dev_res[RES_IRQ_PERIPHERAL_ID].flags = IORESOURCE_IRQ;
|
||||||
res->flags = IORESOURCE_MEM;
|
|
||||||
dev_dbg(dev, "USBSS-XHCI physical base addr: %pa\n",
|
|
||||||
&res->start);
|
|
||||||
|
|
||||||
/* Interrupt for XHCI, */
|
|
||||||
res = &cdnsp->xhci_res[1];
|
|
||||||
res->start = pdev->irq;
|
|
||||||
res->name = "host";
|
|
||||||
res->flags = IORESOURCE_IRQ;
|
|
||||||
} else {
|
} else {
|
||||||
res = &cdnsp->otg_res;
|
res[RES_DRD_ID].start = pci_resource_start(pdev, PCI_BAR_OTG);
|
||||||
res->start = pci_resource_start(pdev, PCI_BAR_OTG);
|
res[RES_DRD_ID].end = pci_resource_end(pdev, PCI_BAR_OTG);
|
||||||
res->end = pci_resource_end(pdev, PCI_BAR_OTG);
|
res[RES_DRD_ID].name = "otg";
|
||||||
res->name = "otg";
|
res[RES_DRD_ID].flags = IORESOURCE_MEM;
|
||||||
res->flags = IORESOURCE_MEM;
|
dev_dbg(&pdev->dev, "CDNSP-DRD physical base addr: %pa\n",
|
||||||
dev_dbg(dev, "CDNSP-DRD physical base addr: %pa\n",
|
&res[RES_DRD_ID].start);
|
||||||
&res->start);
|
|
||||||
|
|
||||||
/* Interrupt for OTG/DRD. */
|
/* Interrupt for OTG/DRD. */
|
||||||
cdnsp->otg_irq = pdev->irq;
|
wrap->dev_res[RES_IRQ_OTG_ID].start = pdev->irq;
|
||||||
|
wrap->dev_res[RES_IRQ_OTG_ID].name = "otg";
|
||||||
|
wrap->dev_res[RES_IRQ_OTG_ID].flags = IORESOURCE_IRQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Cadence PCI based platform require some longer timeout for APB
|
|
||||||
* to fixes domain clock synchronization issue after resuming
|
|
||||||
* controller from L1 state.
|
|
||||||
*/
|
|
||||||
cdnsp->override_apb_timeout = CHICKEN_APB_TIMEOUT_VALUE;
|
|
||||||
pci_set_drvdata(pdev, cdnsp);
|
|
||||||
|
|
||||||
if (pci_is_enabled(func)) {
|
if (pci_is_enabled(func)) {
|
||||||
cdnsp->dev = dev;
|
/* set up platform device info */
|
||||||
cdnsp->gadget_init = cdnsp_gadget_init;
|
pdata.override_apb_timeout = CHICKEN_APB_TIMEOUT_VALUE;
|
||||||
|
memset(&plat_info, 0, sizeof(plat_info));
|
||||||
ret = cdns_init(cdnsp);
|
plat_info.parent = &pdev->dev;
|
||||||
if (ret)
|
plat_info.fwnode = pdev->dev.fwnode;
|
||||||
goto free_cdnsp;
|
plat_info.name = PLAT_DRIVER_NAME;
|
||||||
|
plat_info.id = pdev->devfn;
|
||||||
|
plat_info.res = wrap->dev_res;
|
||||||
|
plat_info.num_res = ARRAY_SIZE(wrap->dev_res);
|
||||||
|
plat_info.dma_mask = pdev->dma_mask;
|
||||||
|
plat_info.data = &pdata;
|
||||||
|
plat_info.size_data = sizeof(pdata);
|
||||||
|
wrap->devfn = pdev->devfn;
|
||||||
|
/* register platform device */
|
||||||
|
wrap->plat_dev = platform_device_register_full(&plat_info);
|
||||||
|
if (IS_ERR(wrap->plat_dev)) {
|
||||||
|
ret = PTR_ERR(wrap->plat_dev);
|
||||||
|
kfree(wrap);
|
||||||
|
goto put_pci;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
device_wakeup_enable(&pdev->dev);
|
pci_set_drvdata(pdev, wrap);
|
||||||
if (pci_dev_run_wake(pdev))
|
|
||||||
pm_runtime_put_noidle(&pdev->dev);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
free_cdnsp:
|
|
||||||
if (!pci_is_enabled(func))
|
|
||||||
kfree(cdnsp);
|
|
||||||
|
|
||||||
put_pci:
|
put_pci:
|
||||||
pci_dev_put(func);
|
pci_dev_put(func);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cdnsp_pci_remove(struct pci_dev *pdev)
|
static void cdnsp_pci_remove(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
struct cdns *cdnsp;
|
struct cdnsp_wrap *wrap;
|
||||||
struct pci_dev *func;
|
struct pci_dev *func;
|
||||||
|
|
||||||
func = cdnsp_get_second_fun(pdev);
|
func = cdnsp_get_second_fun(pdev);
|
||||||
cdnsp = (struct cdns *)pci_get_drvdata(pdev);
|
wrap = pci_get_drvdata(pdev);
|
||||||
|
|
||||||
if (pci_dev_run_wake(pdev))
|
if (wrap->devfn == pdev->devfn)
|
||||||
pm_runtime_get_noresume(&pdev->dev);
|
platform_device_unregister(wrap->plat_dev);
|
||||||
|
|
||||||
if (pci_is_enabled(func)) {
|
if (!pci_is_enabled(func))
|
||||||
cdns_remove(cdnsp);
|
kfree(wrap);
|
||||||
} else {
|
|
||||||
kfree(cdnsp);
|
|
||||||
}
|
|
||||||
|
|
||||||
pci_dev_put(func);
|
pci_dev_put(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __maybe_unused cdnsp_pci_suspend(struct device *dev)
|
|
||||||
{
|
|
||||||
struct cdns *cdns = dev_get_drvdata(dev);
|
|
||||||
|
|
||||||
return cdns_suspend(cdns);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __maybe_unused cdnsp_pci_resume(struct device *dev)
|
|
||||||
{
|
|
||||||
struct cdns *cdns = dev_get_drvdata(dev);
|
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&cdns->lock, flags);
|
|
||||||
ret = cdns_resume(cdns);
|
|
||||||
spin_unlock_irqrestore(&cdns->lock, flags);
|
|
||||||
cdns_set_active(cdns, 1);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct dev_pm_ops cdnsp_pci_pm_ops = {
|
|
||||||
SET_SYSTEM_SLEEP_PM_OPS(cdnsp_pci_suspend, cdnsp_pci_resume)
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct pci_device_id cdnsp_pci_ids[] = {
|
static const struct pci_device_id cdnsp_pci_ids[] = {
|
||||||
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP),
|
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP),
|
||||||
.class = PCI_CLASS_SERIAL_USB_DEVICE },
|
.class = PCI_CLASS_SERIAL_USB_DEVICE },
|
||||||
|
|
@ -230,13 +202,10 @@ static const struct pci_device_id cdnsp_pci_ids[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pci_driver cdnsp_pci_driver = {
|
static struct pci_driver cdnsp_pci_driver = {
|
||||||
.name = "cdnsp-pci",
|
.name = PCI_DRIVER_NAME,
|
||||||
.id_table = cdnsp_pci_ids,
|
.id_table = cdnsp_pci_ids,
|
||||||
.probe = cdnsp_pci_probe,
|
.probe = cdnsp_pci_probe,
|
||||||
.remove = cdnsp_pci_remove,
|
.remove = cdnsp_pci_remove,
|
||||||
.driver = {
|
|
||||||
.pm = &cdnsp_pci_pm_ops,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module_pci_driver(cdnsp_pci_driver);
|
module_pci_driver(cdnsp_pci_driver);
|
||||||
|
|
@ -245,4 +214,4 @@ MODULE_DEVICE_TABLE(pci, cdnsp_pci_ids);
|
||||||
MODULE_ALIAS("pci:cdnsp");
|
MODULE_ALIAS("pci:cdnsp");
|
||||||
MODULE_AUTHOR("Pawel Laszczak <pawell@cadence.com>");
|
MODULE_AUTHOR("Pawel Laszczak <pawell@cadence.com>");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
MODULE_DESCRIPTION("Cadence CDNSP PCI driver");
|
MODULE_DESCRIPTION("Cadence CDNSP PCI wrapper");
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "host-export.h"
|
|
||||||
#include "drd.h"
|
#include "drd.h"
|
||||||
|
|
||||||
static int cdns_idle_init(struct cdns *cdns);
|
static int cdns_idle_init(struct cdns *cdns);
|
||||||
|
|
@ -80,7 +79,7 @@ static void cdns_exit_roles(struct cdns *cdns)
|
||||||
*
|
*
|
||||||
* Returns 0 on success otherwise negative errno
|
* Returns 0 on success otherwise negative errno
|
||||||
*/
|
*/
|
||||||
static int cdns_core_init_role(struct cdns *cdns)
|
int cdns_core_init_role(struct cdns *cdns)
|
||||||
{
|
{
|
||||||
struct device *dev = cdns->dev;
|
struct device *dev = cdns->dev;
|
||||||
enum usb_dr_mode best_dr_mode;
|
enum usb_dr_mode best_dr_mode;
|
||||||
|
|
@ -96,23 +95,13 @@ static int cdns_core_init_role(struct cdns *cdns)
|
||||||
* can be restricted later depending on strap pin configuration.
|
* can be restricted later depending on strap pin configuration.
|
||||||
*/
|
*/
|
||||||
if (dr_mode == USB_DR_MODE_UNKNOWN) {
|
if (dr_mode == USB_DR_MODE_UNKNOWN) {
|
||||||
if (cdns->version == CDNSP_CONTROLLER_V2) {
|
if (IS_ENABLED(CONFIG_USB_CDNS3_HOST) &&
|
||||||
if (IS_ENABLED(CONFIG_USB_CDNSP_HOST) &&
|
IS_ENABLED(CONFIG_USB_CDNS3_GADGET))
|
||||||
IS_ENABLED(CONFIG_USB_CDNSP_GADGET))
|
dr_mode = USB_DR_MODE_OTG;
|
||||||
dr_mode = USB_DR_MODE_OTG;
|
else if (IS_ENABLED(CONFIG_USB_CDNS3_HOST))
|
||||||
else if (IS_ENABLED(CONFIG_USB_CDNSP_HOST))
|
dr_mode = USB_DR_MODE_HOST;
|
||||||
dr_mode = USB_DR_MODE_HOST;
|
else if (IS_ENABLED(CONFIG_USB_CDNS3_GADGET))
|
||||||
else if (IS_ENABLED(CONFIG_USB_CDNSP_GADGET))
|
dr_mode = USB_DR_MODE_PERIPHERAL;
|
||||||
dr_mode = USB_DR_MODE_PERIPHERAL;
|
|
||||||
} else {
|
|
||||||
if (IS_ENABLED(CONFIG_USB_CDNS3_HOST) &&
|
|
||||||
IS_ENABLED(CONFIG_USB_CDNS3_GADGET))
|
|
||||||
dr_mode = USB_DR_MODE_OTG;
|
|
||||||
else if (IS_ENABLED(CONFIG_USB_CDNS3_HOST))
|
|
||||||
dr_mode = USB_DR_MODE_HOST;
|
|
||||||
else if (IS_ENABLED(CONFIG_USB_CDNS3_GADGET))
|
|
||||||
dr_mode = USB_DR_MODE_PERIPHERAL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -137,11 +126,8 @@ static int cdns_core_init_role(struct cdns *cdns)
|
||||||
dr_mode = best_dr_mode;
|
dr_mode = best_dr_mode;
|
||||||
|
|
||||||
if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
|
if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
|
||||||
if ((cdns->version == CDNSP_CONTROLLER_V2 &&
|
if (cdns->host_init)
|
||||||
IS_ENABLED(CONFIG_USB_CDNSP_HOST)) ||
|
ret = cdns->host_init(cdns);
|
||||||
(cdns->version < CDNSP_CONTROLLER_V2 &&
|
|
||||||
IS_ENABLED(CONFIG_USB_CDNS3_HOST)))
|
|
||||||
ret = cdns_host_init(cdns);
|
|
||||||
else
|
else
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
|
|
||||||
|
|
@ -197,11 +183,14 @@ static int cdns_core_init_role(struct cdns *cdns)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev_dbg(dev, "Cadence USB3 core: probe succeed\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
cdns_exit_roles(cdns);
|
cdns_exit_roles(cdns);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cdns_core_init_role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cdns_hw_role_state_machine - role switch state machine based on hw events.
|
* cdns_hw_role_state_machine - role switch state machine based on hw events.
|
||||||
|
|
@ -469,14 +458,8 @@ int cdns_init(struct cdns *cdns)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto init_failed;
|
goto init_failed;
|
||||||
|
|
||||||
ret = cdns_core_init_role(cdns);
|
|
||||||
if (ret)
|
|
||||||
goto init_failed;
|
|
||||||
|
|
||||||
spin_lock_init(&cdns->lock);
|
spin_lock_init(&cdns->lock);
|
||||||
|
|
||||||
dev_dbg(dev, "Cadence USB3 core: probe succeed\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
init_failed:
|
init_failed:
|
||||||
cdns_drd_exit(cdns);
|
cdns_drd_exit(cdns);
|
||||||
|
|
@ -576,5 +559,5 @@ EXPORT_SYMBOL_GPL(cdns_set_active);
|
||||||
MODULE_AUTHOR("Peter Chen <peter.chen@nxp.com>");
|
MODULE_AUTHOR("Peter Chen <peter.chen@nxp.com>");
|
||||||
MODULE_AUTHOR("Pawel Laszczak <pawell@cadence.com>");
|
MODULE_AUTHOR("Pawel Laszczak <pawell@cadence.com>");
|
||||||
MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
|
MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
|
||||||
MODULE_DESCRIPTION("Cadence USBSS and USBSSP DRD Driver");
|
MODULE_DESCRIPTION("Cadence USBSS/USBSSP DRD driver (core, DRD, platform, optional host/gadget)");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ struct cdns3_platform_data {
|
||||||
unsigned long quirks;
|
unsigned long quirks;
|
||||||
#define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0)
|
#define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0)
|
||||||
#define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1)
|
#define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1)
|
||||||
|
u32 override_apb_timeout; /* 0 = use default (e.g. for PCI) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -82,6 +83,7 @@ struct cdns3_platform_data {
|
||||||
* @override_apb_timeout: hold value of APB timeout. For value 0 the default
|
* @override_apb_timeout: hold value of APB timeout. For value 0 the default
|
||||||
* value in CHICKEN_BITS_3 will be preserved.
|
* value in CHICKEN_BITS_3 will be preserved.
|
||||||
* @gadget_init: pointer to gadget initialization function
|
* @gadget_init: pointer to gadget initialization function
|
||||||
|
* @host_init: pointer to host initialization function
|
||||||
*/
|
*/
|
||||||
struct cdns {
|
struct cdns {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
@ -120,13 +122,14 @@ struct cdns {
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct xhci_plat_priv *xhci_plat_data;
|
struct xhci_plat_priv *xhci_plat_data;
|
||||||
u32 override_apb_timeout;
|
u32 override_apb_timeout;
|
||||||
|
|
||||||
int (*gadget_init)(struct cdns *cdns);
|
int (*gadget_init)(struct cdns *cdns);
|
||||||
|
int (*host_init)(struct cdns *cdns);
|
||||||
};
|
};
|
||||||
|
|
||||||
int cdns_hw_role_switch(struct cdns *cdns);
|
int cdns_hw_role_switch(struct cdns *cdns);
|
||||||
int cdns_init(struct cdns *cdns);
|
int cdns_init(struct cdns *cdns);
|
||||||
int cdns_remove(struct cdns *cdns);
|
int cdns_remove(struct cdns *cdns);
|
||||||
|
int cdns_core_init_role(struct cdns *cdns);
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
int cdns_resume(struct cdns *cdns);
|
int cdns_resume(struct cdns *cdns);
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,10 @@
|
||||||
#ifndef __LINUX_CDNS3_GADGET_EXPORT
|
#ifndef __LINUX_CDNS3_GADGET_EXPORT
|
||||||
#define __LINUX_CDNS3_GADGET_EXPORT
|
#define __LINUX_CDNS3_GADGET_EXPORT
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_USB_CDNSP_GADGET)
|
#if IS_ENABLED(CONFIG_USB_CDNS3_GADGET)
|
||||||
|
|
||||||
int cdnsp_gadget_init(struct cdns *cdns);
|
int cdnsp_gadget_init(struct cdns *cdns);
|
||||||
|
int cdns3_gadget_init(struct cdns *cdns);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline int cdnsp_gadget_init(struct cdns *cdns)
|
static inline int cdnsp_gadget_init(struct cdns *cdns)
|
||||||
|
|
@ -20,13 +21,6 @@ static inline int cdnsp_gadget_init(struct cdns *cdns)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_USB_CDNSP_GADGET */
|
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_USB_CDNS3_GADGET)
|
|
||||||
|
|
||||||
int cdns3_gadget_init(struct cdns *cdns);
|
|
||||||
#else
|
|
||||||
|
|
||||||
static inline int cdns3_gadget_init(struct cdns *cdns)
|
static inline int cdns3_gadget_init(struct cdns *cdns)
|
||||||
{
|
{
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#ifndef __LINUX_CDNS3_HOST_EXPORT
|
#ifndef __LINUX_CDNS3_HOST_EXPORT
|
||||||
#define __LINUX_CDNS3_HOST_EXPORT
|
#define __LINUX_CDNS3_HOST_EXPORT
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_USB_CDNS_HOST)
|
#if IS_ENABLED(CONFIG_USB_CDNS3_HOST)
|
||||||
|
|
||||||
int cdns_host_init(struct cdns *cdns);
|
int cdns_host_init(struct cdns *cdns);
|
||||||
|
|
||||||
|
|
@ -22,6 +22,6 @@ static inline int cdns_host_init(struct cdns *cdns)
|
||||||
|
|
||||||
static inline void cdns_host_exit(struct cdns *cdns) { }
|
static inline void cdns_host_exit(struct cdns *cdns) { }
|
||||||
|
|
||||||
#endif /* USB_CDNS_HOST */
|
#endif /* CONFIG_USB_CDNS3_HOST */
|
||||||
|
|
||||||
#endif /* __LINUX_CDNS3_HOST_EXPORT */
|
#endif /* __LINUX_CDNS3_HOST_EXPORT */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user