drivers/usb/dwc3/glue.h

Source file repositories/reference/linux-study-clean/drivers/usb/dwc3/glue.h

File Facts

System
Linux kernel
Corpus path
drivers/usb/dwc3/glue.h
Extension
.h
Size
7363 bytes
Lines
197
Domain
Driver Families
Bucket
drivers/usb
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dwc3_properties {
	u32 gsbuscfg0_reqinfo;
	unsigned needs_full_reinit:1;
};

#define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){		\
	.gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED,	\
	})

/**
 * dwc3_probe_data: Initialization parameters passed to dwc3_core_probe()
 * @dwc: Reference to dwc3 context structure
 * @res: resource for the DWC3 core mmio region
 * @ignore_clocks_and_resets: clocks and resets defined for the device should
 *		be ignored by the DWC3 core, as they are managed by the glue
 * @skip_core_init_mode: Skip the finial initialization of the target mode, as
 *		it must be managed by the glue
 * @properties: dwc3 software manage properties
 */
struct dwc3_probe_data {
	struct dwc3 *dwc;
	struct resource *res;
	bool ignore_clocks_and_resets;
	bool skip_core_init_mode;
	struct dwc3_properties properties;
};

/**
 * dwc3_core_probe - Initialize the core dwc3 driver
 * @data: Initialization and configuration parameters for the controller
 *
 * Initializes the DesignWare USB3 core driver by setting up resources,
 * registering interrupts, performing hardware setup, and preparing
 * the controller for operation in the appropriate mode (host, gadget,
 * or OTG). This is the main initialization function called by glue
 * layer drivers to set up the core controller.
 *
 * Return: 0 on success, negative error code on failure
 */
int dwc3_core_probe(const struct dwc3_probe_data *data);

/**
 * dwc3_core_remove - Deinitialize and remove the core dwc3 driver
 * @dwc: Pointer to DWC3 controller context
 *
 * Cleans up resources and disables the dwc3 core driver. This should be called
 * during driver removal or when the glue layer needs to shut down the
 * controller completely.
 */
void dwc3_core_remove(struct dwc3 *dwc);

/*
 * The following callbacks are provided for glue drivers to call from their
 * own pm callbacks provided in struct dev_pm_ops. Glue drivers can perform
 * platform-specific work before or after calling these functions and delegate
 * the core suspend/resume operations to the core driver.
 */
int dwc3_runtime_suspend(struct dwc3 *dwc);
int dwc3_runtime_resume(struct dwc3 *dwc);
int dwc3_runtime_idle(struct dwc3 *dwc);
int dwc3_pm_suspend(struct dwc3 *dwc);
int dwc3_pm_resume(struct dwc3 *dwc);
void dwc3_pm_complete(struct dwc3 *dwc);
int dwc3_pm_prepare(struct dwc3 *dwc);


/* All of the following functions must only be used with skip_core_init_mode */

/**
 * dwc3_core_init - Initialize DWC3 core hardware
 * @dwc: Pointer to DWC3 controller context
 *
 * Configures and initializes the core hardware, usually done by dwc3_core_probe.
 * This function is provided for platforms that use skip_core_init_mode and need
 * to finalize the core initialization after some platform-specific setup.
 * It must only be called when using skip_core_init_mode and before
 * dwc3_host_init or dwc3_gadget_init.
 *
 * Return: 0 on success, negative error code on failure
 */
int dwc3_core_init(struct dwc3 *dwc);

/**
 * dwc3_core_exit - Shut down DWC3 core hardware
 * @dwc: Pointer to DWC3 controller context
 *
 * Disables and cleans up the core hardware state. This is usually handled
 * internally by dwc3 and must only be called when using skip_core_init_mode
 * and only after dwc3_core_init. Afterwards, dwc3_core_init may be called
 * again.

Annotation

Implementation Notes