drivers/usb/dwc2/params.c
Source file repositories/reference/linux-study-clean/drivers/usb/dwc2/params.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/dwc2/params.c- Extension
.c- Size
- 31276 bytes
- Lines
- 1084
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/of.hlinux/usb/of.hlinux/pci_ids.hlinux/pci.hcore.h
Detected Declarations
function Copyrightfunction dwc2_set_his_paramsfunction dwc2_set_jz4775_paramsfunction dwc2_set_loongson_paramsfunction dwc2_set_x1600_paramsfunction dwc2_set_x2000_paramsfunction dwc2_set_s3c6400_paramsfunction dwc2_set_socfpga_agilex_paramsfunction dwc2_set_rk_paramsfunction dwc2_set_ltq_danube_paramsfunction dwc2_set_ltq_ase_paramsfunction dwc2_set_ltq_xrx200_paramsfunction dwc2_set_amlogic_paramsfunction dwc2_set_amlogic_g12a_paramsfunction dwc2_set_amlogic_a1_paramsfunction dwc2_set_amcc_paramsfunction dwc2_set_cv1800_paramsfunction dwc2_set_stm32f4x9_fsotg_paramsfunction dwc2_set_stm32f7_hsotg_paramsfunction dwc2_set_stm32mp15_fsotg_paramsfunction dwc2_set_stm32mp15_hsotg_paramsfunction dwc2_set_param_otg_capfunction dwc2_set_param_phy_typefunction dwc2_set_param_speedfunction dwc2_set_param_phy_utmi_widthfunction dwc2_set_param_tx_fifo_sizesfunction dwc2_set_param_power_downfunction dwc2_set_param_lpmfunction dwc2_set_default_paramsfunction dwc2_get_device_propertiesfunction dwc2_check_param_otg_capfunction dwc2_check_param_phy_typefunction dwc2_check_param_speedfunction dwc2_check_param_phy_utmi_widthfunction dwc2_check_param_power_downfunction dwc2_check_param_tx_fifo_sizesfunction dwc2_check_param_eusb2_discfunction dwc2_check_paramsfunction dwc2_get_host_hwparamsfunction dwc2_get_dev_hwparamsfunction dwc2_get_hwparamsfunction dwc2_limit_speedfunction dwc2_init_paramsexport dwc2_pci_ids
Annotated Snippet
if (num > 0) {
num = min(num, 15);
memset(p->g_tx_fifo_size, 0,
sizeof(p->g_tx_fifo_size));
device_property_read_u32_array(hsotg->dev,
"g-tx-fifo-size",
&p->g_tx_fifo_size[1],
num);
}
of_usb_update_otg_caps(hsotg->dev->of_node, &p->otg_caps);
}
p->oc_disable = of_property_read_bool(hsotg->dev->of_node, "disable-over-current");
}
static void dwc2_check_param_otg_cap(struct dwc2_hsotg *hsotg)
{
int valid = 1;
if (hsotg->params.otg_caps.hnp_support && hsotg->params.otg_caps.srp_support) {
/* check HNP && SRP capable */
if (hsotg->hw_params.op_mode != GHWCFG2_OP_MODE_HNP_SRP_CAPABLE)
valid = 0;
} else if (!hsotg->params.otg_caps.hnp_support) {
/* check SRP only capable */
if (hsotg->params.otg_caps.srp_support) {
switch (hsotg->hw_params.op_mode) {
case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE:
case GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE:
case GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE:
case GHWCFG2_OP_MODE_SRP_CAPABLE_HOST:
break;
default:
valid = 0;
break;
}
}
/* else: NO HNP && NO SRP capable: always valid */
} else {
valid = 0;
}
if (!valid)
dwc2_set_param_otg_cap(hsotg);
}
static void dwc2_check_param_phy_type(struct dwc2_hsotg *hsotg)
{
int valid = 0;
u32 hs_phy_type;
u32 fs_phy_type;
hs_phy_type = hsotg->hw_params.hs_phy_type;
fs_phy_type = hsotg->hw_params.fs_phy_type;
switch (hsotg->params.phy_type) {
case DWC2_PHY_TYPE_PARAM_FS:
if (fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED)
valid = 1;
break;
case DWC2_PHY_TYPE_PARAM_UTMI:
if ((hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI) ||
(hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI_ULPI))
valid = 1;
break;
case DWC2_PHY_TYPE_PARAM_ULPI:
if ((hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI) ||
(hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI_ULPI))
valid = 1;
break;
default:
break;
}
if (!valid)
dwc2_set_param_phy_type(hsotg);
}
static void dwc2_check_param_speed(struct dwc2_hsotg *hsotg)
{
int valid = 1;
int phy_type = hsotg->params.phy_type;
int speed = hsotg->params.speed;
switch (speed) {
case DWC2_SPEED_PARAM_HIGH:
if ((hsotg->params.speed == DWC2_SPEED_PARAM_HIGH) &&
(phy_type == DWC2_PHY_TYPE_PARAM_FS))
valid = 0;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/usb/of.h`, `linux/pci_ids.h`, `linux/pci.h`, `core.h`.
- Detected declarations: `function Copyright`, `function dwc2_set_his_params`, `function dwc2_set_jz4775_params`, `function dwc2_set_loongson_params`, `function dwc2_set_x1600_params`, `function dwc2_set_x2000_params`, `function dwc2_set_s3c6400_params`, `function dwc2_set_socfpga_agilex_params`, `function dwc2_set_rk_params`, `function dwc2_set_ltq_danube_params`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: integration implementation candidate.
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.