drivers/ata/libahci_platform.c

Source file repositories/reference/linux-study-clean/drivers/ata/libahci_platform.c

File Facts

System
Linux kernel
Corpus path
drivers/ata/libahci_platform.c
Extension
.c
Size
24160 bytes
Lines
968
Domain
Driver Families
Bucket
drivers/ata
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (rc) {
			phy_exit(hpriv->phys[i]);
			goto disable_phys;
		}

		rc = phy_power_on(hpriv->phys[i]);
		if (rc) {
			phy_exit(hpriv->phys[i]);
			goto disable_phys;
		}
	}

	return 0;

disable_phys:
	while (--i >= 0) {
		if (ahci_ignore_port(hpriv, i))
			continue;

		phy_power_off(hpriv->phys[i]);
		phy_exit(hpriv->phys[i]);
	}
	return rc;
}
EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);

/**
 * ahci_platform_disable_phys - Disable PHYs
 * @hpriv: host private area to store config values
 *
 * This function disables all PHYs found in hpriv->phys.
 */
void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
{
	int i;

	for (i = 0; i < hpriv->nports; i++) {
		if (ahci_ignore_port(hpriv, i))
			continue;

		phy_power_off(hpriv->phys[i]);
		phy_exit(hpriv->phys[i]);
	}
}
EXPORT_SYMBOL_GPL(ahci_platform_disable_phys);

/**
 * ahci_platform_find_clk - Find platform clock
 * @hpriv: host private area to store config values
 * @con_id: clock connection ID
 *
 * This function returns a pointer to the clock descriptor of the clock with
 * the passed ID.
 *
 * RETURNS:
 * Pointer to the clock descriptor on success otherwise NULL
 */
struct clk *ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id)
{
	int i;

	for (i = 0; i < hpriv->n_clks; i++) {
		if (hpriv->clks[i].id && !strcmp(hpriv->clks[i].id, con_id))
			return hpriv->clks[i].clk;
	}

	return NULL;
}
EXPORT_SYMBOL_GPL(ahci_platform_find_clk);

/**
 * ahci_platform_enable_clks - Enable platform clocks
 * @hpriv: host private area to store config values
 *
 * This function enables all the clks found for the AHCI device.
 *
 * RETURNS:
 * 0 on success otherwise a negative error code
 */
int ahci_platform_enable_clks(struct ahci_host_priv *hpriv)
{
	return clk_bulk_prepare_enable(hpriv->n_clks, hpriv->clks);
}
EXPORT_SYMBOL_GPL(ahci_platform_enable_clks);

/**
 * ahci_platform_disable_clks - Disable platform clocks
 * @hpriv: host private area to store config values
 *
 * This function disables all the clocks enabled before

Annotation

Implementation Notes