drivers/usb/renesas_usbhs/common.c
Source file repositories/reference/linux-study-clean/drivers/usb/renesas_usbhs/common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/renesas_usbhs/common.c- Extension
.c- Size
- 21101 bytes
- Lines
- 906
- 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/err.hlinux/gpio/consumer.hlinux/io.hlinux/module.hlinux/of.hlinux/pm_runtime.hlinux/reset.hlinux/slab.hlinux/sysfs.hcommon.hrcar2.hrcar3.hrza.h
Detected Declarations
function Copyrightfunction usbhs_writefunction usbhs_bsetfunction usbhs_get_id_as_gadgetfunction usbhs_sys_clock_ctrlfunction usbhs_sys_host_ctrlfunction usbhs_sys_function_ctrlfunction usbhs_sys_function_pullupfunction usbhs_sys_set_test_modefunction usbhs_frame_get_numfunction usbhs_usbreq_get_valfunction usbhs_usbreq_set_valfunction usbhs_bus_send_sof_enablefunction usbhs_bus_send_resetfunction usbhs_bus_get_speedfunction usbhs_vbus_ctrlfunction usbhsc_bus_initfunction usbhs_set_device_configfunction usbhs_xxxsts_clearfunction usbhsc_set_buswaitfunction usbhsc_is_multi_clksfunction usbhsc_clk_getfunction usbhsc_clk_putfunction usbhsc_clk_prepare_enablefunction usbhsc_clk_disable_unpreparefunction usbhsc_power_ctrlfunction usbhsc_hotplugfunction usbhsc_notify_hotplugfunction usbhsc_schedule_notify_hotplugfunction usbhs_probefunction usbhs_removefunction usbhsc_restorefunction usbhsc_suspendfunction usbhsc_resume
Annotated Snippet
else if (IS_ERR(priv->clks[1])) {
clk_put(priv->clks[0]);
return PTR_ERR(priv->clks[1]);
}
return 0;
}
static void usbhsc_clk_put(struct usbhs_priv *priv)
{
int i;
if (!usbhsc_is_multi_clks(priv))
return;
for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
clk_put(priv->clks[i]);
}
static int usbhsc_clk_prepare_enable(struct usbhs_priv *priv)
{
int i, ret;
if (!usbhsc_is_multi_clks(priv))
return 0;
for (i = 0; i < ARRAY_SIZE(priv->clks); i++) {
ret = clk_prepare_enable(priv->clks[i]);
if (ret) {
while (--i >= 0)
clk_disable_unprepare(priv->clks[i]);
return ret;
}
}
return ret;
}
static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv)
{
int i;
if (!usbhsc_is_multi_clks(priv))
return;
for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
clk_disable_unprepare(priv->clks[i]);
}
/*
* platform default param
*/
/* commonly used on old SH-Mobile and RZ/G2L family SoCs */
static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = {
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x58, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x68, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x07, false),
};
/* commonly used on newer SH-Mobile and R-Car SoCs */
static struct renesas_usbhs_driver_pipe_config usbhsc_new_pipe[] = {
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x58, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x68, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x78, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x88, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x98, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xa8, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xb8, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xc8, true),
RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xd8, true),
};
/*
* power control
*/
Annotation
- Immediate include surface: `linux/clk.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `linux/reset.h`.
- Detected declarations: `function Copyright`, `function usbhs_write`, `function usbhs_bset`, `function usbhs_get_id_as_gadget`, `function usbhs_sys_clock_ctrl`, `function usbhs_sys_host_ctrl`, `function usbhs_sys_function_ctrl`, `function usbhs_sys_function_pullup`, `function usbhs_sys_set_test_mode`, `function usbhs_frame_get_num`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.