drivers/usb/cdns3/cdns3-plat.c
Source file repositories/reference/linux-study-clean/drivers/usb/cdns3/cdns3-plat.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/cdns3/cdns3-plat.c- Extension
.c- Size
- 7851 bytes
- Lines
- 345
- 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/module.hlinux/irq.hlinux/kernel.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hcore.hgadget-export.hdrd.h
Detected Declarations
function Copyrightfunction set_phy_power_offfunction cdns3_plat_probefunction cdns3_plat_removefunction cdns3_set_platform_suspendfunction cdns3_controller_suspendfunction cdns3_controller_resumefunction cdns3_plat_runtime_suspendfunction cdns3_plat_runtime_resumefunction cdns3_plat_suspendfunction cdns3_plat_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Cadence USBSS DRD Driver.
*
* Copyright (C) 2018-2020 Cadence.
* Copyright (C) 2017-2018 NXP
* Copyright (C) 2019 Texas Instruments
*
*
* Author: Peter Chen <peter.chen@nxp.com>
* Pawel Laszczak <pawell@cadence.com>
* Roger Quadros <rogerq@ti.com>
*/
#include <linux/module.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include "core.h"
#include "gadget-export.h"
#include "drd.h"
static int set_phy_power_on(struct cdns *cdns)
{
int ret;
ret = phy_power_on(cdns->usb2_phy);
if (ret)
return ret;
ret = phy_power_on(cdns->usb3_phy);
if (ret)
phy_power_off(cdns->usb2_phy);
return ret;
}
static void set_phy_power_off(struct cdns *cdns)
{
phy_power_off(cdns->usb3_phy);
phy_power_off(cdns->usb2_phy);
}
/**
* cdns3_plat_probe - probe for cdns3 core device
* @pdev: Pointer to cdns3 core platform device
*
* Returns 0 on success otherwise negative errno
*/
static int cdns3_plat_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct resource *res;
struct cdns *cdns;
void __iomem *regs;
int ret;
cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL);
if (!cdns)
return -ENOMEM;
cdns->dev = dev;
cdns->pdata = dev_get_platdata(dev);
platform_set_drvdata(pdev, cdns);
ret = platform_get_irq_byname(pdev, "host");
if (ret < 0)
return ret;
cdns->xhci_res[0].start = ret;
cdns->xhci_res[0].end = ret;
cdns->xhci_res[0].flags = IORESOURCE_IRQ | irq_get_trigger_type(ret);
cdns->xhci_res[0].name = "host";
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "xhci");
if (!res) {
dev_err(dev, "couldn't get xhci resource\n");
return -ENXIO;
}
cdns->xhci_res[1] = *res;
cdns->dev_irq = platform_get_irq_byname(pdev, "peripheral");
if (cdns->dev_irq < 0)
return dev_err_probe(dev, cdns->dev_irq,
Annotation
- Immediate include surface: `linux/module.h`, `linux/irq.h`, `linux/kernel.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `core.h`, `gadget-export.h`.
- Detected declarations: `function Copyright`, `function set_phy_power_off`, `function cdns3_plat_probe`, `function cdns3_plat_remove`, `function cdns3_set_platform_suspend`, `function cdns3_controller_suspend`, `function cdns3_controller_resume`, `function cdns3_plat_runtime_suspend`, `function cdns3_plat_runtime_resume`, `function cdns3_plat_suspend`.
- 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.