drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c

Source file repositories/reference/linux-study-clean/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c

File Facts

System
Linux kernel
Corpus path
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
Extension
.c
Size
3483 bytes
Lines
146
Domain
Driver Families
Bucket
drivers/phy
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 ipq4019_usb_phy {
	struct device		*dev;
	struct phy		*phy;
	void __iomem		*base;
	struct reset_control	*por_rst;
	struct reset_control	*srif_rst;
};

static int ipq4019_ss_phy_power_off(struct phy *_phy)
{
	struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);

	reset_control_assert(phy->por_rst);
	msleep(10);

	return 0;
}

static int ipq4019_ss_phy_power_on(struct phy *_phy)
{
	struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);

	ipq4019_ss_phy_power_off(_phy);

	reset_control_deassert(phy->por_rst);

	return 0;
}

static const struct phy_ops ipq4019_usb_ss_phy_ops = {
	.power_on	= ipq4019_ss_phy_power_on,
	.power_off	= ipq4019_ss_phy_power_off,
};

static int ipq4019_hs_phy_power_off(struct phy *_phy)
{
	struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);

	reset_control_assert(phy->por_rst);
	msleep(10);

	reset_control_assert(phy->srif_rst);
	msleep(10);

	return 0;
}

static int ipq4019_hs_phy_power_on(struct phy *_phy)
{
	struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);

	ipq4019_hs_phy_power_off(_phy);

	reset_control_deassert(phy->srif_rst);
	msleep(10);

	reset_control_deassert(phy->por_rst);

	return 0;
}

static const struct phy_ops ipq4019_usb_hs_phy_ops = {
	.power_on	= ipq4019_hs_phy_power_on,
	.power_off	= ipq4019_hs_phy_power_off,
};

static const struct of_device_id ipq4019_usb_phy_of_match[] = {
	{ .compatible = "qcom,usb-hs-ipq4019-phy", .data = &ipq4019_usb_hs_phy_ops},
	{ .compatible = "qcom,usb-ss-ipq4019-phy", .data = &ipq4019_usb_ss_phy_ops},
	{ },
};
MODULE_DEVICE_TABLE(of, ipq4019_usb_phy_of_match);

static int ipq4019_usb_phy_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct phy_provider *phy_provider;
	struct ipq4019_usb_phy *phy;

	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
	if (!phy)
		return -ENOMEM;

	phy->dev = &pdev->dev;
	phy->base = devm_platform_ioremap_resource(pdev, 0);
	if (IS_ERR(phy->base)) {
		dev_err(dev, "failed to remap register memory\n");
		return PTR_ERR(phy->base);
	}

Annotation

Implementation Notes