drivers/usb/renesas_usbhs/pipe.c
Source file repositories/reference/linux-study-clean/drivers/usb/renesas_usbhs/pipe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/renesas_usbhs/pipe.c- Extension
.c- Size
- 17866 bytes
- Lines
- 853
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/slab.hcommon.hpipe.h
Detected Declarations
function usbhsp_pipectrl_setfunction usbhsp_pipectrl_getfunction __usbhsp_pipe_xxx_setfunction __usbhsp_pipe_xxx_getfunction usbhsp_pipe_cfg_setfunction usbhsp_pipe_cfg_getfunction usbhsp_pipe_trn_setfunction usbhsp_pipe_tre_setfunction usbhsp_pipe_buf_setfunction usbhsp_pipe_maxp_setfunction usbhsp_pipe_selectfunction usbhsp_pipe_barrierfunction usbhs_pipe_is_accessiblefunction usbhs_pipe_contains_transmittable_datafunction __usbhsp_pid_try_nak_if_stallfunction usbhs_pipe_disablefunction usbhs_pipe_enablefunction usbhs_pipe_stallfunction usbhs_pipe_is_stallfunction usbhs_pipe_set_trans_count_if_bulkfunction usbhsp_setup_pipecfgfunction usbhsp_setup_pipebufffunction usbhs_pipe_config_updatefunction usbhs_pipe_get_maxpacketfunction usbhs_pipe_is_dir_infunction usbhs_pipe_is_dir_hostfunction usbhs_pipe_is_runningfunction usbhs_pipe_runningfunction usbhs_pipe_data_sequencefunction usbhs_pipe_get_data_sequencefunction usbhs_pipe_clearfunction usbhs_pipe_clear_without_sequencefunction usbhs_pipe_config_change_bfrefunction usbhsp_put_pipefunction usbhs_pipe_initfunction usbhs_for_each_pipe_with_dcpfunction usbhs_pipe_freefunction usbhs_pipe_select_fifofunction usbhs_dcp_control_transfer_donefunction usbhs_dcp_dir_for_hostfunction usbhs_pipe_probefunction usbhs_pipe_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-1.0+
/*
* Renesas USB driver
*
* Copyright (C) 2011 Renesas Solutions Corp.
* Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
*/
#include <linux/delay.h>
#include <linux/slab.h>
#include "common.h"
#include "pipe.h"
/*
* macros
*/
#define usbhsp_addr_offset(p) ((usbhs_pipe_number(p) - 1) * 2)
#define usbhsp_flags_set(p, f) ((p)->flags |= USBHS_PIPE_FLAGS_##f)
#define usbhsp_flags_clr(p, f) ((p)->flags &= ~USBHS_PIPE_FLAGS_##f)
#define usbhsp_flags_has(p, f) ((p)->flags & USBHS_PIPE_FLAGS_##f)
#define usbhsp_flags_init(p) do {(p)->flags = 0; } while (0)
/*
* for debug
*/
static char *usbhsp_pipe_name[] = {
[USB_ENDPOINT_XFER_CONTROL] = "DCP",
[USB_ENDPOINT_XFER_BULK] = "BULK",
[USB_ENDPOINT_XFER_INT] = "INT",
[USB_ENDPOINT_XFER_ISOC] = "ISO",
};
char *usbhs_pipe_name(struct usbhs_pipe *pipe)
{
return usbhsp_pipe_name[usbhs_pipe_type(pipe)];
}
static struct renesas_usbhs_driver_pipe_config
*usbhsp_get_pipe_config(struct usbhs_priv *priv, int pipe_num)
{
struct renesas_usbhs_driver_pipe_config *pipe_configs =
usbhs_get_dparam(priv, pipe_configs);
return &pipe_configs[pipe_num];
}
/*
* DCPCTR/PIPEnCTR functions
*/
static void usbhsp_pipectrl_set(struct usbhs_pipe *pipe, u16 mask, u16 val)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
int offset = usbhsp_addr_offset(pipe);
if (usbhs_pipe_is_dcp(pipe))
usbhs_bset(priv, DCPCTR, mask, val);
else
usbhs_bset(priv, PIPEnCTR + offset, mask, val);
}
static u16 usbhsp_pipectrl_get(struct usbhs_pipe *pipe)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
int offset = usbhsp_addr_offset(pipe);
if (usbhs_pipe_is_dcp(pipe))
return usbhs_read(priv, DCPCTR);
else
return usbhs_read(priv, PIPEnCTR + offset);
}
/*
* DCP/PIPE functions
*/
static void __usbhsp_pipe_xxx_set(struct usbhs_pipe *pipe,
u16 dcp_reg, u16 pipe_reg,
u16 mask, u16 val)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
if (usbhs_pipe_is_dcp(pipe))
usbhs_bset(priv, dcp_reg, mask, val);
else
usbhs_bset(priv, pipe_reg, mask, val);
}
static u16 __usbhsp_pipe_xxx_get(struct usbhs_pipe *pipe,
u16 dcp_reg, u16 pipe_reg)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/slab.h`, `common.h`, `pipe.h`.
- Detected declarations: `function usbhsp_pipectrl_set`, `function usbhsp_pipectrl_get`, `function __usbhsp_pipe_xxx_set`, `function __usbhsp_pipe_xxx_get`, `function usbhsp_pipe_cfg_set`, `function usbhsp_pipe_cfg_get`, `function usbhsp_pipe_trn_set`, `function usbhsp_pipe_tre_set`, `function usbhsp_pipe_buf_set`, `function usbhsp_pipe_maxp_set`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.